feat 增加配置中心支持
This commit is contained in:
@ -3,6 +3,6 @@
|
||||
public static class AdminConsts
|
||||
{
|
||||
public const string DbTablePrefix = "App";
|
||||
|
||||
public const string DbSchema = null;
|
||||
public const string DbSchema = "";
|
||||
public const string ConnectionStringName = "Default";
|
||||
}
|
||||
@ -18,7 +18,7 @@ namespace KonSoft.Admin.EntityFrameworkCore;
|
||||
|
||||
[ReplaceDbContext(typeof(IIdentityDbContext))]
|
||||
[ReplaceDbContext(typeof(ITenantManagementDbContext))]
|
||||
[ConnectionStringName("Default")]
|
||||
[ConnectionStringName(AdminConsts.ConnectionStringName)]
|
||||
public class AdminDbContext :
|
||||
AbpDbContext<AdminDbContext>,
|
||||
IIdentityDbContext,
|
||||
@ -52,9 +52,7 @@ public class AdminDbContext :
|
||||
public DbSet<IdentitySecurityLog> SecurityLogs { get; set; }
|
||||
public DbSet<IdentityLinkUser> LinkUsers { get; set; }
|
||||
public DbSet<IdentityUserDelegation> UserDelegations { get; set; }
|
||||
|
||||
public DbSet<IdentitySession> Sessions { get; set; }
|
||||
|
||||
public DbSet<Tenant> Tenants { get; set; }
|
||||
public DbSet<TenantConnectionString> TenantConnectionStrings { get; set; }
|
||||
}
|
||||
@ -20,7 +20,7 @@ public class AdminDbContextFactory : IDesignTimeDbContextFactory<AdminDbContext>
|
||||
var configuration = BuildConfiguration();
|
||||
|
||||
var builder = new DbContextOptionsBuilder<AdminDbContext>()
|
||||
.UseNpgsql(configuration.GetConnectionString("Default"));
|
||||
.UseNpgsql(configuration.GetConnectionString(AdminConsts.ConnectionStringName));
|
||||
|
||||
return new AdminDbContext(builder.Options);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user