⚠️feat: SqlSugar自动识别所有连接字符串

This commit is contained in:
yubaolee
2025-06-28 17:14:35 +08:00
parent b38391fddd
commit b61b315d27
7 changed files with 151 additions and 59 deletions

View File

@@ -76,8 +76,8 @@ namespace OpenAuth.IdentityServer
//在startup里面只能通过这种方式获取到appsettings里面的值不能用IOptions😰
var dbtypes = ((ConfigurationSection)Configuration.GetSection("AppSetting:DbTypes")).GetChildren()
.ToDictionary(x => x.Key, x => x.Value);
var dbType = dbtypes["OpenAuthDBContext"];
var connectionString = Configuration.GetConnectionString("OpenAuthDBContext");
var dbType = dbtypes[Define.DEFAULT_TENANT_ID];
var connectionString = Configuration.GetConnectionString(Define.DEFAULT_TENANT_ID);
if (dbType == Define.DBTYPE_SQLSERVER)
{
services.AddDbContext<OpenAuthDBContext>(options =>