Beispiel #1
0
        public TariffServiceStorage(ICacheNotify <TariffCacheItem> notify, ICache cache)
        {
            Cache  = cache;
            Notify = notify;
            Notify.Subscribe((i) =>
            {
                Cache.Remove(TariffService.GetTariffCacheKey(i.TenantId));
                Cache.Remove(TariffService.GetBillingUrlCacheKey(i.TenantId));
                Cache.Remove(TariffService.GetBillingPaymentCacheKey(i.TenantId)); // clear all payments
            }, CacheNotifyAction.Remove);

            //TODO: Change code of WCF -> not supported in .NET standard/.Net Core

            /*try
             * {
             *  var section = (ClientSection)ConfigurationManager.GetSection("system.serviceModel/client");
             *  if (section != null)
             *  {
             *      billingConfigured = section.Endpoints.Cast<ChannelEndpointElement>()
             *          .Any(e => e.Contract == typeof(IService).FullName);
             *  }
             * }
             * catch (Exception err)
             * {
             *  log.Error(err);
             * }*/
        }
Beispiel #2
0
        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 = new CachedQuotaService(new DbQuotaService(cs));
            var subService = new CachedSubscriptionService(new DbSubscriptionService(cs));
            var tariffService = new TariffService(cs, quotaService, tenantService);

            Configuration = new CoreConfiguration(tenantService);
            TenantManager = new TenantManager(tenantService, quotaService, tariffService);
            PaymentManager = new PaymentManager(Configuration, quotaService, tariffService);
            UserManager = new UserManager(userService);
            Authentication = new AuthManager(userService);
            AuthorizationManager = new AuthorizationManager(azService);
            SubscriptionManager = new SubscriptionManager(subService);
        }
Beispiel #3
0
        private static void ConfigureCoreContextByDefault()
        {
            var cs = ConfigurationManager.ConnectionStrings["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 = new CachedQuotaService(new DbQuotaService(cs));
            var subService = new CachedSubscriptionService(new DbSubscriptionService(cs));
            var tariffService = new TariffService(cs, quotaService, tenantService);

            Configuration = new ClientConfiguration(tenantService);
            TenantManager = new ClientTenantManager(tenantService, quotaService, Configuration.Standalone ? null : tariffService);
            UserManager = new ClientUserManager(userService);
            GroupManager = new ClientUserManager(userService);
            Authentication = new ClientAuthManager(userService);
            AuthorizationManager = new ClientAzManager(azService);
            SubscriptionManager = new ClientSubscriptionManager(subService);
        }