public CacheUsingCachingBlockBuilder(IConfigureSecuritySettings context, string cachingStoreName) :base(context) { cachingStoreData = new CachingStoreProviderData { Name = cachingStoreName }; SecuritySettings.SecurityCacheProviders.Add(cachingStoreData); }
public void Setup() { CachingStoreProviderData securityCacheProvider = new CachingStoreProviderData(); securityCacheProvider.Name = "Caching Store Provider"; SecuritySettings settings = new SecuritySettings(); settings.SecurityCacheProviders.Add(securityCacheProvider); registrations = settings.GetRegistrations(null); }
public void CachingStoreProviderNodeTest() { string name = "some name"; int absoluteExpiration = 123; int slidingExpiration = 345; CachingStoreProviderData data = new CachingStoreProviderData(); data.Name = name; data.AbsoluteExpiration = absoluteExpiration; data.SlidingExpiration = slidingExpiration; CachingStoreProviderNode node = new CachingStoreProviderNode(data); Assert.AreEqual(name, node.Name); Assert.AreEqual(absoluteExpiration, node.AbsoluteExpiration); Assert.AreEqual(slidingExpiration, node.SlidingExpiration); }
/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// Builds an <see cref="CachingStoreProvider"/> based on an instance of <see cref="SecurityCacheProviderData"/>. /// </summary> /// <seealso cref="SecurityCacheProviderCustomFactory"/> /// <param name="context">The <see cref="IBuilderContext"/> that represents the current building process.</param> /// <param name="objectConfiguration">The configuration object that describes the object to build. Must be an instance of <see cref="CachingStoreProviderData"/>.</param> /// <param name="configurationSource">The source for configuration objects.</param> /// <param name="reflectionCache">The cache to use retrieving reflection information.</param> /// <returns>A fully initialized instance of <see cref="CachingStoreProvider"/>.</returns> public ISecurityCacheProvider Assemble(IBuilderContext context, SecurityCacheProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { CachingStoreProviderData castedObjectConfiguration = (CachingStoreProviderData)objectConfiguration; CacheManager securityCacheManager = (CacheManager)context.HeadOfChain.BuildUp(context, typeof(CacheManager), null, castedObjectConfiguration.CacheManager); ISecurityCacheProvider createdObject = new CachingStoreProvider( castedObjectConfiguration.SlidingExpiration, castedObjectConfiguration.AbsoluteExpiration, securityCacheManager); return(createdObject); }