Ejemplo n.º 1
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 ClientConfiguration(tenantService);
            TenantManager        = new ClientTenantManager(tenantService, quotaService, tariffService);
            PaymentManager       = new ClientPaymentManager(Configuration, quotaService, tariffService);
            UserManager          = new ClientUserManager(userService);
            GroupManager         = new ClientUserManager(userService);
            Authentication       = new ClientAuthManager(userService);
            AuthorizationManager = new ClientAzManager(azService);
            SubscriptionManager  = new ClientSubscriptionManager(subService);
        }
Ejemplo n.º 2
0
        public UserManager(IUserService service)
        {
            userService = service;

            dbUserService = new DbUserService(DbRegistry.GetConnectionString("core"));

            systemUsers = Configuration.Constants.SystemAccounts.ToDictionary(a => a.ID, a => new UserInfo {
                ID = a.ID, LastName = a.Name
            });
            systemUsers[Constants.LostUser.ID]     = Constants.LostUser;
            systemUsers[Constants.OutsideUser.ID]  = Constants.OutsideUser;
            systemUsers[Constants.NamingPoster.ID] = Constants.NamingPoster;
        }
Ejemplo n.º 3
0
 protected override Type ResolveConnectionType()
 {
     if (!string.IsNullOrEmpty(ConnectionStringName) && string.IsNullOrEmpty(ConnectionString))
     {
         try
         {
             ConnectionString = DbRegistry.GetConnectionString(ConnectionStringName).ConnectionString;
             using (var connection = DbRegistry.CreateDbConnection(ConnectionStringName))
             {
                 ConnectionType = connection.GetType().AssemblyQualifiedName;
             }
         }
         catch (Exception exception)
         {
             ErrorHandler.Error("Failed to load resolve connection [" + ConnectionStringName + "]", exception);
             throw;
         }
     }
     return(base.ResolveConnectionType());
 }
Ejemplo n.º 4
0
 public ConnectionStringSettings GetRegionConnectionString(string region)
 {
     return(DbRegistry.GetConnectionString(GetRegionService(region).DbId));
 }
Ejemplo n.º 5
0
 public System.Configuration.ConnectionStringSettings GetRegionConnectionString(string region)
 {
     return(DbRegistry.GetConnectionString(GetRegionService(region).DbId));
 }
Ejemplo n.º 6
0
 public void RegistryTest()
 {
     Assert.AreEqual(cs, DbRegistry.GetConnectionString(dbId));
     Assert.IsTrue(DbRegistry.IsDatabaseRegistered(dbId));
     Assert.IsNotNull(DbRegistry.CreateDbConnection(dbId));
 }
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     return(DbRegistry.GetConnectionString((string)value));
 }