public static void RegisterCacheInfrastructure(IKernel kernel, ObjectCache cache, ICacheKeyRegistrationService cacheKeyRegistrationService) { kernel.Bind<ICacheKeyGenerationService>().To<CacheKeyGenerationService>(); kernel.Bind<ICacheKeyRegistrationService>().ToConstant(cacheKeyRegistrationService); kernel.Bind<ObjectCache>().ToConstant(cache); }
/// <summary> /// Adds the Cash-specific registrations to the Autofac container builder. /// </summary> /// <param name="builder">The Autofac <see cref="ContainerBuilder"/></param> /// <param name="cacheProvider">The <see cref="ObjectCache"/> instance to use as a cache provider.</param> /// <param name="registrationService">The <see cref="ICacheKeyRegistrationService"/> that contains the registrations for this solution. </param> public static void RegisterCacheInfrastructure(ContainerBuilder builder, ObjectCache cacheProvider, ICacheKeyRegistrationService registrationService) { builder.Register(x => cacheProvider).As<ObjectCache>().SingleInstance(); builder.RegisterType<CacheKeyGenerationService>().As<ICacheKeyGenerationService>().SingleInstance(); builder.Register(x => registrationService).As<ICacheKeyRegistrationService>().SingleInstance(); builder.Register(c => new CachingInterceptor(c.Resolve<ObjectCache>(), c.Resolve<ICacheKeyGenerationService>())).InstancePerDependency(); }
public CacheKeyGenerationService(ICacheKeyRegistrationService cacheKeyRegistrationService) { _cacheKeyProviders = new List <ICacheKeyProvider> { new NullCacheKeyProvider(), new EumCacheKeyProvider(), new PrimitiveTypeCacheKeyProvider(), new UserRegisteredCacheKeyProvider(cacheKeyRegistrationService) }.OrderBy(x => (int)x.ExecutionOrder); }
public CacheKeyGenerationService(ICacheKeyRegistrationService cacheKeyRegistrationService) { _cacheKeyProviders = new List<ICacheKeyProvider> { new NullCacheKeyProvider(), new EumCacheKeyProvider(), new PrimitiveTypeCacheKeyProvider(), new UserRegisteredCacheKeyProvider(cacheKeyRegistrationService) }.OrderBy(x => (int)x.ExecutionOrder); }
public static void RegisterDependencies(ICacheKeyRegistrationService cacheKeyRegistrationService) { var builder = new ContainerBuilder(); builder.RegisterControllers(typeof(MvcApplication).Assembly); Cash.RegisterCacheInfrastructure(builder, MemoryCache.Default, cacheKeyRegistrationService); builder.RegisterType<RandomDataService>().As<IRandomDataService>().SingleInstance().WithDefaultCache(); builder.RegisterType<UserService>().As<IUserService>().SingleInstance().WithDefaultCache(); var container = builder.Build(); DependencyResolver.SetResolver(new AutofacDependencyResolver(container)); }
public static void RegisterDependencies(ICacheKeyRegistrationService cacheKeyRegistrationService) { var builder = new ContainerBuilder(); builder.RegisterControllers(typeof(MvcApplication).Assembly); Cash.RegisterCacheInfrastructure(builder, MemoryCache.Default, cacheKeyRegistrationService); builder.RegisterType <RandomDataService>().As <IRandomDataService>().SingleInstance().WithDefaultCache(); builder.RegisterType <UserService>().As <IUserService>().SingleInstance().WithDefaultCache(); var container = builder.Build(); DependencyResolver.SetResolver(new AutofacDependencyResolver(container)); }
public UserRegisteredCacheKeyProvider(ICacheKeyRegistrationService cacheKeyRegistrationService) : base(cacheKeyRegistrationService) { }
public void Initialize() { Builder = new ContainerBuilder(); Cache = A.Fake<ObjectCache>(); RegistrationService = A.Fake<ICacheKeyRegistrationService>(); }
public void Initialize() { CacheKeyRegistrationService = A.Fake <ICacheKeyRegistrationService>(); CacheKeyGenerationService = new CacheKeyGenerationService(CacheKeyRegistrationService); }
public void Initialize() { Kernel = new StandardKernel(); Cache = A.Fake <ObjectCache>(); RegistrationService = A.Fake <ICacheKeyRegistrationService>(); }
/// <summary> /// Adds the Cash-specific registrations to the Autofac container builder. /// </summary> /// <param name="builder">The Autofac <see cref="ContainerBuilder"/></param> /// <param name="cacheProvider">The <see cref="ObjectCache"/> instance to use as a cache provider.</param> /// <param name="registrationService">The <see cref="ICacheKeyRegistrationService"/> that contains the registrations for this solution. </param> public static void RegisterCacheInfrastructure(ContainerBuilder builder, ObjectCache cacheProvider, ICacheKeyRegistrationService registrationService) { builder.Register(x => cacheProvider).As <ObjectCache>().SingleInstance(); builder.RegisterType <CacheKeyGenerationService>().As <ICacheKeyGenerationService>().SingleInstance(); builder.Register(x => registrationService).As <ICacheKeyRegistrationService>().SingleInstance(); builder.Register(c => new CachingInterceptor(c.Resolve <ObjectCache>(), c.Resolve <ICacheKeyGenerationService>())).InstancePerDependency(); }
public void Initialize() { Kernel = new StandardKernel(); Cache = A.Fake<ObjectCache>(); RegistrationService = A.Fake<ICacheKeyRegistrationService>(); }
protected BaseRegisteredCacheKeyProvider(ICacheKeyRegistrationService cacheKeyRegistrationService) { CacheKeyRegistrationService = cacheKeyRegistrationService; }
public static void RegisterCacheInfrastructure(IKernel kernel, ObjectCache cache, ICacheKeyRegistrationService cacheKeyRegistrationService) { kernel.Bind <ICacheKeyGenerationService>().To <CacheKeyGenerationService>(); kernel.Bind <ICacheKeyRegistrationService>().ToConstant(cacheKeyRegistrationService); kernel.Bind <ObjectCache>().ToConstant(cache); }
public void Initialize() { Builder = new ContainerBuilder(); Cache = A.Fake <ObjectCache>(); RegistrationService = A.Fake <ICacheKeyRegistrationService>(); }
public void Initialize() { CacheKeyRegistrationService = A.Fake<ICacheKeyRegistrationService>(); CacheKeyGenerationService = new CacheKeyGenerationService(CacheKeyRegistrationService); }