Exemple #1
0
        /// <summary>
        /// Creates a new DBConfigurationSection. The Implementation &amp; Profiler collections are also
        /// created so that any default values can be added.
        /// </summary>
        private static DBConfigurationSection CreateDefaultConfiguration()
        {
            DBConfigurationSection defined = new DBConfigurationSection();

            defined.Implementations = new DBProviderImplementationConfigSection();
            defined.Implementations.Implementations = new DBProviderImplementationConfigElementCollection();
            defined.Profilers           = new DBProfilerConfigSection();
            defined.Profilers.Profilers = new DBProfilerDefinitionConfigElementCollection();

            return(defined);
        }
Exemple #2
0
 /// <summary>
 /// Returns the configured DBConfigurationSection.
 /// If it does not exist then a default one is created and returned
 /// </summary>
 /// <returns></returns>
 public static DBConfigurationSection GetSection()
 {
     if (null == _defined)
     {
         _defined = System.Configuration.ConfigurationManager.GetSection(DBConfigurationSection.DBConfigSectionElement) as DBConfigurationSection;
         if (null == _defined)//There is no section so create an empty one.
         {
             _defined = CreateDefaultConfiguration();
         }
     }
     return(_defined);
 }