public void Providers() { var ocs = WebConfigurationManager.GetWebApplicationSection("system.web/caching/outputCache") as OutputCacheSection; OutputCacheProviderCollection coll = OutputCache.Providers; Assert.IsNull(coll, "#A1"); Assert.IsNotNull(ocs.Providers, "#B1-1"); Assert.AreEqual(0, ocs.Providers.Count, "#B1-2"); }
internal OutputCacheProviderCollection CreateProviderCollection() { ProviderSettingsCollection configProviders = this.Providers; if ((configProviders == null) || (configProviders.Count == 0)) { return(null); } OutputCacheProviderCollection providers = new OutputCacheProviderCollection(); ProvidersHelper.InstantiateProviders(configProviders, providers, typeof(OutputCacheProvider)); providers.SetReadOnly(); return(providers); }
internal OutputCacheProviderCollection CreateProviderCollection() { // if there are no providers defined, we'll default to the v2.0 OutputCache ProviderSettingsCollection providers = Providers; if (providers == null || providers.Count == 0) { return(null); } OutputCacheProviderCollection collection = new OutputCacheProviderCollection(); ProvidersHelper.InstantiateProviders(providers, collection, typeof(OutputCacheProvider)); collection.SetReadOnly(); return(collection); }
internal OutputCacheProvider GetDefaultProvider(OutputCacheProviderCollection providers) { string defaultProviderName = this.DefaultProviderName; if (defaultProviderName == "AspNetInternalProvider") { return(null); } OutputCacheProvider provider = (providers == null) ? null : providers[defaultProviderName]; if (provider == null) { throw new ConfigurationErrorsException(System.Web.SR.GetString("Def_provider_not_found"), base.ElementInformation.Properties["defaultProvider"].Source, base.ElementInformation.Properties["defaultProvider"].LineNumber); } return(provider); }
internal OutputCacheProvider GetDefaultProvider(OutputCacheProviderCollection providers) { // if defaultProvider is undefined, we'll default to the v2.0 OutputCache string defaultProviderName = DefaultProviderName; if (defaultProviderName == OutputCache.ASPNET_INTERNAL_PROVIDER_NAME) { return(null); } // if the defaultProvider is defined, it must be in the providers collection OutputCacheProvider defaultProvider = (providers == null) ? null : providers[defaultProviderName]; if (defaultProvider == null) { throw new ConfigurationErrorsException(SR.GetString(SR.Def_provider_not_found), ElementInformation.Properties["defaultProvider"].Source, ElementInformation.Properties["defaultProvider"].LineNumber); } return(defaultProvider); }