diff --git a/Src/Asp.Net/SqlSugar/SqlSugarClient.cs b/Src/Asp.Net/SqlSugar/SqlSugarClient.cs index f354422fb..181d71a8b 100644 --- a/Src/Asp.Net/SqlSugar/SqlSugarClient.cs +++ b/Src/Asp.Net/SqlSugar/SqlSugarClient.cs @@ -18,7 +18,7 @@ namespace SqlSugar private SqlSugarProvider _Context = null; private string _ThreadId; private ConnectionConfig _CurrentConnectionConfig; - private List _AllClients; + internal List _AllClients; private bool _IsAllTran = false; private bool _IsOpen = false; private MappingTableList _MappingTables; @@ -1202,6 +1202,16 @@ namespace SqlSugar { var result= new SqlSugarClient(UtilMethods.CopyConfig(this.Ado.Context.CurrentConnectionConfig)); result.QueryFilter = this.QueryFilter; + if (_AllClients != null) + { + foreach (var item in _AllClients) + { + if (!result.IsAnyConnection(item.ConnectionConfig.ConfigId)) + { + result.AddConnection(UtilMethods.CopyConfig(item.ConnectionConfig)); + } + } + } return result; } public DateTime GetDate() diff --git a/Src/Asp.Net/SqlSugar/SqlSugarScope.cs b/Src/Asp.Net/SqlSugar/SqlSugarScope.cs index 9bbdd6922..765e8d9e7 100644 --- a/Src/Asp.Net/SqlSugar/SqlSugarScope.cs +++ b/Src/Asp.Net/SqlSugar/SqlSugarScope.cs @@ -850,6 +850,16 @@ namespace SqlSugar { var result= new SqlSugarClient(UtilMethods.CopyConfig(this.Ado.Context.CurrentConnectionConfig)); result.QueryFilter = this.QueryFilter; + if (this.ScopedContext._AllClients != null) + { + foreach (var item in this.ScopedContext._AllClients) + { + if (!result.IsAnyConnection(item.ConnectionConfig.ConfigId)) + { + result.AddConnection(UtilMethods.CopyConfig(item.ConnectionConfig)); + } + } + } return result; } public DynamicBuilder DynamicBuilder()