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 <imageService> section CheeseServiceSection section = (CheeseServiceSection) WebConfigurationManager.GetSection ("system.web/CheeseService"); // Load registered providers and point _provider // to the default provider _providers = new CheeseProviderCollection(); ProvidersHelper.InstantiateProviders (section.Providers, _providers, typeof(CheeseProvider)); _provider = _providers[section.DefaultProvider]; if (_provider == null) { throw new ProviderException ("Unable to load default ImageProvider"); } } } } }
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 <imageService> section CheeseServiceSection section = (CheeseServiceSection) WebConfigurationManager.GetSection ("system.web/CheeseService"); // Load registered providers and point _provider // to the default provider _providers = new CheeseProviderCollection(); ProvidersHelper.InstantiateProviders (section.Providers, _providers, typeof(CheeseProvider)); _provider = _providers[section.DefaultProvider]; if (_provider == null) throw new ProviderException ("Unable to load default ImageProvider"); } } } }