示例#1
0
        internal static IResourceProvider GetLocalResourceProvider(VirtualPath virtualPath)
        {
            CacheInternal     cacheInternal = HttpRuntime.CacheInternal;
            string            key           = "A" + virtualPath.VirtualPathString;
            IResourceProvider provider      = cacheInternal[key] as IResourceProvider;

            if (provider == null)
            {
                EnsureResourceProviderFactory();
                provider = s_resourceProviderFactory.CreateLocalResourceProvider(virtualPath.VirtualPathString);
                cacheInternal.UtcInsert(key, provider);
            }
            return(provider);
        }
        // Get the page-level IResourceProvider
        internal static IResourceProvider GetLocalResourceProvider(VirtualPath virtualPath)
        {
            // If we have it cached, return it (it may be null if there are no local resources)
            CacheInternal     cacheInternal    = System.Web.HttpRuntime.CacheInternal;
            string            cacheKey         = CacheInternal.PrefixResourceProvider + virtualPath.VirtualPathString;
            IResourceProvider resourceProvider = cacheInternal[cacheKey] as IResourceProvider;

            if (resourceProvider != null)
            {
                return(resourceProvider);
            }

            EnsureResourceProviderFactory();
            resourceProvider = s_resourceProviderFactory.CreateLocalResourceProvider(virtualPath.VirtualPathString);

            // Cache it
            cacheInternal.UtcInsert(cacheKey, resourceProvider);

            return(resourceProvider);
        }