////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// static private void InitProviders(ProfileSection config) { if (!s_InitializedProviders) { s_Providers = new ProfileProviderCollection(); if (config.Providers != null) { ProvidersHelper.InstantiateProviders(config.Providers, s_Providers, typeof(ProfileProvider)); } s_InitializedProviders = true; } bool canInitializeDefaultProvider = (!HostingEnvironment.IsHosted || BuildManager.PreStartInitStage == PreStartInitStage.AfterPreStartInit); if (!s_InitializeDefaultProvider && canInitializeDefaultProvider) { s_Providers.SetReadOnly(); if (config.DefaultProvider == null) { throw new ProviderException(SR.GetString(SR.Profile_default_provider_not_specified)); } s_Provider = (ProfileProvider)s_Providers[config.DefaultProvider]; if (s_Provider == null) { throw new ConfigurationErrorsException(SR.GetString(SR.Profile_default_provider_not_found), config.ElementInformation.Properties["providers"].Source, config.ElementInformation.Properties["providers"].LineNumber); } s_InitializeDefaultProvider = true; } }
private static void InitProviders(ProfileSection config) { if (!s_InitializedProviders) { s_Providers = new ProfileProviderCollection(); if (config.Providers != null) { ProvidersHelper.InstantiateProviders(config.Providers, s_Providers, typeof(ProfileProvider)); } s_InitializedProviders = true; } bool flag = !HostingEnvironment.IsHosted || (BuildManager.PreStartInitStage == PreStartInitStage.AfterPreStartInit); if (!s_InitializeDefaultProvider && flag) { s_Providers.SetReadOnly(); if (config.DefaultProvider == null) { throw new ProviderException(System.Web.SR.GetString("Profile_default_provider_not_specified")); } s_Provider = s_Providers[config.DefaultProvider]; if (s_Provider == null) { throw new ConfigurationErrorsException(System.Web.SR.GetString("Profile_default_provider_not_found"), config.ElementInformation.Properties["providers"].Source, config.ElementInformation.Properties["providers"].LineNumber); } s_InitializeDefaultProvider = true; } }