private static void LoadProviders() { // Avoid claiming lock if providers are already loaded if (_defaultProvider == null) { lock (_lock) { // Do this again to make sure _defaultProvider is still null if (_defaultProvider == null) { ServicesSection section = (ServicesSection) WebConfigurationManager.GetSection("servicesProvider"); _providers = new ServicesProviderCollection(); ProvidersHelper.InstantiateProviders( section.Providers, _providers, typeof(ServicesProvider)); _defaultProvider = _providers[section.DefaultProvider]; if (_defaultProvider == null) { throw new ProviderException ("Unable to load default ServiceHostProvider"); } } } } }
private static void LoadProviders() { // Avoid claiming lock if providers are already loaded if (_defaultProvider == null) { lock (_lock) { // Do this again to make sure _defaultProvider is still null if (_defaultProvider == null) { ServicesSection section = (ServicesSection) WebConfigurationManager.GetSection("servicesProvider"); _providers = new ServicesProviderCollection(); ProvidersHelper.InstantiateProviders( section.Providers, _providers, typeof(ServicesProvider)); _defaultProvider = _providers[section.DefaultProvider]; if (_defaultProvider == null) throw new ProviderException ("Unable to load default ServiceHostProvider"); } } } }