public CachedSubscriptionService(DbSubscriptionService service, SubscriptionServiceCache subscriptionServiceCache) { this.service = service ?? throw new ArgumentNullException("service"); cache = subscriptionServiceCache.Cache; notifyRecord = subscriptionServiceCache.NotifyRecord; notifyMethod = subscriptionServiceCache.NotifyMethod; CacheExpiration = TimeSpan.FromMinutes(5); }
private static void ConfigureCoreContextByDefault() { var cs = DbRegistry.GetConnectionString("core"); if (cs == null) { throw new ConfigurationErrorsException("Can not configure CoreContext: connection string with name core not found."); } var tenantService = new CachedTenantService(new DbTenantService(cs)); var userService = new CachedUserService(new DbUserService(cs)); var azService = new CachedAzService(new DbAzService(cs)); var quotaService = QuotaCacheEnabled ? (IQuotaService) new CachedQuotaService(new DbQuotaService(cs)) : new DbQuotaService(cs); var subService = new DbSubscriptionService(cs);// new CachedSubscriptionService(); var tariffService = new TariffService(cs, quotaService, tenantService); Configuration = new CoreConfiguration(tenantService); TenantManager = new TenantManager(tenantService, quotaService, tariffService); PaymentManager = new PaymentManager(tariffService); UserManager = new UserManager(userService); Authentication = new AuthManager(userService); AuthorizationManager = new AuthorizationManager(azService); SubscriptionManager = new SubscriptionManager(subService); }