/// <summary> /// Gets the factory section instance. /// </summary> internal static void InitializeFactorySection() { try { lockFactorySection.EnterUpgradeableReadLock(); if (_factorySectionAlreadyInitialized) { return; } if (ConfigurationManager.GetSection(AdoFactoriesConfigurationSection.SECTION_NAME) != null) { AdoFactoriesConfigurationSection configFileSection = ConfigurationManager.GetSection(AdoFactoriesConfigurationSection.SECTION_NAME) as AdoFactoriesConfigurationSection; if (configFileSection != null) { try { lockFactorySection.EnterWriteLock(); _factorySection = new Dictionary <string, FactoryConfigurationElement>(); foreach (FactoryConfigurationElement elem in configFileSection.Factories) { if (!_factorySection.ContainsKey(elem.Name)) { _factorySection.Add(elem.Name, elem); } } } finally { lockFactorySection.ExitWriteLock(); } } } try { lockFactorySection.EnterWriteLock(); if (_factorySection == null) { _factorySection = new Dictionary <string, FactoryConfigurationElement>(); LoadDefaultFactorySettings(_factorySection); } } finally { lockFactorySection.ExitWriteLock(); } if (_factorySection == null) { throw new ArgumentException("There was an error getting the configuration file information. Please check the configuration file."); } } finally { _factorySectionAlreadyInitialized = true; lockFactorySection.ExitUpgradeableReadLock(); } }
private static AdoFactoriesConfigurationSection GetDefaultFactoriesSettings() { AdoFactoriesConfigurationSection newfactorySection = new AdoFactoriesConfigurationSection(); newfactorySection.Factories.Add(new FactoryConfigurationElement("Access", "System.Data.OleDb", DatabaseType.Access, true)); newfactorySection.Factories.Add(new FactoryConfigurationElement("SQLServer", "System.Data.SqlClient", DatabaseType.SQLServer, false)); //New Changes //newfactorySection.Factories.Add(new FactoryConfigurationElement("Oracle", "Oracle.DataAccess.Client", DatabaseType.Oracle, false)); newfactorySection.Factories.Add(new FactoryConfigurationElement("Oracle", "System.Data.OracleClient", DatabaseType.Oracle, false)); newfactorySection.Factories.Add(new FactoryConfigurationElement("ODBC", "System.Data.Odbc", DatabaseType.Access, false)); return(newfactorySection); }