public DatabaseManager()
        {
            Chapter09SectionGroup chapter09Config = Chapter09Configuration.GetConfig();
            Chapter09Section      section         = chapter09Config.Chapter09Section;

            db = DatabaseFactory.CreateDatabase(section.ConnectionStringName);
        }
示例#2
0
        public void Test104_ReadConfiguration()
        {
            Chapter09SectionGroup chapter09Config = Chapter09Configuration.GetConfig();
            Chapter09Section      section         = chapter09Config.Chapter09Section;

            Assert.IsNotNull(section);
            Console.WriteLine("ConnectionStringName: " + section.ConnectionStringName);
            Assert.IsNotEmpty(section.ConnectionStringName);
        }
示例#3
0
        public void Test105_ReadConfiguration()
        {
            Chapter09SectionGroup chapter09Config = Chapter09Configuration.GetConfig();
            Chapter09Section      section         = chapter09Config.Chapter09Section;

            Assert.IsNotNull(section);
            Console.WriteLine("EnableAutoUpdates: " + section.EnableAutoUpdates);
            Assert.IsTrue(section.EnableAutoUpdates);
        }
示例#4
0
        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);
        }