🐛fix: #ICGHSO 修复因统一Sqlsugar引起的BUG

This commit is contained in:
yubaolee
2025-08-02 18:53:10 +08:00
parent 217b407cd9
commit 4ed8c0819b
2 changed files with 39 additions and 17 deletions

View File

@@ -100,6 +100,15 @@ namespace OpenAuth.App.Test
Console.WriteLine($"添加数据库连接: {conn.Key} / {(dbtypes.ContainsKey(conn.Key) ? dbtypes[conn.Key] : "")},连接字符串:{conn.Value}");
}
//通过ConfigId为空判断是否有默认的连接字符串
if(!connectionConfigs.Any(x => x.ConfigId == null))
{
throw new Exception($"没有找到默认的连接字符串:{Define.DEFAULT_TENANT_ID}");
}
//把connectionConfigs排序ConfigId为空的放在最前面即默认的连接字符串必须排最前面
connectionConfigs = connectionConfigs.OrderBy(x => x.ConfigId == null ? 0 : 1).ToList();
var sqlSugar = new SqlSugarClient(connectionConfigs);
// 配置PostgreSQL数据库处理