예제 #1
0
        private static IResourceProvider GetGlobalResourceProvider(string classKey)
        {
            string            str           = "Resources." + classKey;
            CacheInternal     cacheInternal = HttpRuntime.CacheInternal;
            string            key           = "A" + str;
            IResourceProvider provider      = cacheInternal[key] as IResourceProvider;

            if (provider == null)
            {
                EnsureResourceProviderFactory();
                provider = s_resourceProviderFactory.CreateGlobalResourceProvider(classKey);
                cacheInternal.UtcInsert(key, provider);
            }
            return(provider);
        }
        private static IResourceProvider GetGlobalResourceProvider(string classKey)
        {
            string fullClassName = BaseResourcesBuildProvider.DefaultResourcesNamespace +
                                   "." + classKey;

            // If we have it cached, return it
            CacheInternal     cacheInternal    = System.Web.HttpRuntime.CacheInternal;
            string            cacheKey         = CacheInternal.PrefixResourceProvider + fullClassName;
            IResourceProvider resourceProvider = cacheInternal[cacheKey] as IResourceProvider;

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

            EnsureResourceProviderFactory();
            resourceProvider = s_resourceProviderFactory.CreateGlobalResourceProvider(classKey);

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

            return(resourceProvider);
        }