mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-08-23 22:11:35 +08:00
🐛fix: #ICP1R9 当有多个租户时,默认租户不起作用
This commit is contained in:
parent
e6410c9da6
commit
d7f48e0537
@ -188,6 +188,15 @@ namespace OpenAuth.WebApi
|
|||||||
logger.LogInformation($"添加数据库连接: {conn.Key} / {(dbtypes.ContainsKey(conn.Key) ? dbtypes[conn.Key] : "未指定类型")},连接字符串:{conn.Value}");
|
logger.LogInformation($"添加数据库连接: {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);
|
var sqlSugar = new SqlSugarClient(connectionConfigs);
|
||||||
|
|
||||||
// 配置PostgreSQL数据库处理
|
// 配置PostgreSQL数据库处理
|
||||||
|
Loading…
Reference in New Issue
Block a user