public DatabaseManager() { Chapter09SectionGroup chapter09Config = Chapter09Configuration.GetConfig(); Chapter09Section section = chapter09Config.Chapter09Section; db = DatabaseFactory.CreateDatabase(section.ConnectionStringName); }
public void Test104_ReadConfiguration() { Chapter09SectionGroup chapter09Config = Chapter09Configuration.GetConfig(); Chapter09Section section = chapter09Config.Chapter09Section; Assert.IsNotNull(section); Console.WriteLine("ConnectionStringName: " + section.ConnectionStringName); Assert.IsNotEmpty(section.ConnectionStringName); }
public void Test105_ReadConfiguration() { Chapter09SectionGroup chapter09Config = Chapter09Configuration.GetConfig(); Chapter09Section section = chapter09Config.Chapter09Section; Assert.IsNotNull(section); Console.WriteLine("EnableAutoUpdates: " + section.EnableAutoUpdates); Assert.IsTrue(section.EnableAutoUpdates); }
public void Test103_ReadConfiguration() { Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); Chapter09SectionGroup chapter09Config = (Chapter09SectionGroup)config.SectionGroups["chapter09Group"]; Chapter09Section section = chapter09Config.Chapter09Section; Assert.IsNotNull(section); Console.WriteLine("ConnectionStringName: " + section.ConnectionStringName); Assert.IsNotEmpty(section.ConnectionStringName); }
public bool IsAutoUpdatesEnabled() { // Use AppSettings //string setting = ConfigurationManager.AppSettings["EnableAutoUpdates"]; //bool isAutoUpdatesEnabled = false; //bool.TryParse(setting, out isAutoUpdatesEnabled); //return isAutoUpdatesEnabled; // Use custom configuration section Chapter09SectionGroup chapter09Config = Chapter09Configuration.GetConfig(); Chapter09Section section = chapter09Config.Chapter09Section; return(section.EnableAutoUpdates); }