/// <summary> /// Load the providers from the web.config. /// </summary> private static void LoadProviders() { // 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 <blogProvider> section TrainProviderSection section = (TrainProviderSection)WebConfigurationManager.GetSection("TrainEngine/TrainProvider"); // Load registered providers and point _provider // to the default provider _providers = new TrainProviderCollection(); ProvidersHelper.InstantiateProviders(section.Providers, _providers, typeof(TrainProvider)); _provider = _providers[section.DefaultProvider]; if (_provider == null) { throw new ProviderException("Unable to load default TrainProvider"); } } } } }
/// <summary> /// Load the providers from the web.config. /// </summary> private static void LoadProviders() { // 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 <blogProvider> section TrainProviderSection section = (TrainProviderSection)WebConfigurationManager.GetSection("TrainEngine/TrainProvider"); // Load registered providers and point _provider // to the default provider _providers = new TrainProviderCollection(); ProvidersHelper.InstantiateProviders(section.Providers, _providers, typeof(TrainProvider)); _provider = _providers[section.DefaultProvider]; if (_provider == null) throw new ProviderException("Unable to load default TrainProvider"); } } } }