Esempio n. 1
0
        static Databases()
        {
            // avoid claiming lock if providers are already loaded
            if (_provider == null)
            {
                lock (_lock)
                {
                    // do this again to make sure _provider is still null
                    if (_provider == null)
                    {
                        // get a reference to the <configurationManager> section
                        DatabaseManagerSection section = WebConfigurationManager.GetSection("managedFusion/databaseManager") as DatabaseManagerSection;

                        // set the connection string name
                        _defaultConnectionStringName = section.DefaultConnectionStringName;

                        // Load registered providers and point _provider to the default provider
                        _providers = new DatabaseProviderCollection();
                        ProvidersHelper.InstantiateProviders(section.Providers, _providers, typeof(DatabaseProvider));
                        _provider = _providers[section.DefaultProvider];

                        if (_provider == null)
                            throw new ProviderException("Unable to load default DatabaseProvider");
                    }
                }
            }
        }
Esempio n. 2
0
 public HostConfig()
 {
     Runtime     = new HostRuntimeConfiguration();
     Caching     = new CacheConfigurationSection();
     Database    = new DatabaseProviderCollection();
     Certificate = new CertificateProviderCollection();
 }