diff --git a/Src/Asp.Net/SqlSugar/ScopedClient.cs b/Src/Asp.Net/SqlSugar/ScopedClient.cs index dde4fe6e9..17f364c51 100644 --- a/Src/Asp.Net/SqlSugar/ScopedClient.cs +++ b/Src/Asp.Net/SqlSugar/ScopedClient.cs @@ -10,29 +10,29 @@ namespace SqlSugar { public class ScopedClient : ISqlSugarClient, ITenant { - private SqlSugarClient db; - private Action configAction; + private List _configs; + private Action _configAction; private ScopedClient() { } public ScopedClient(ConnectionConfig config) { - this.db = new SqlSugarClient(config); + _configs=new List() { config}; } public ScopedClient(List configs) { - this.db = new SqlSugarClient(configs); + _configs = configs; } public ScopedClient(ConnectionConfig config, Action configAction) { - this.db = new SqlSugarClient(config); - this.configAction = configAction; + _configs = new List() { config }; + this._configAction = configAction; } public ScopedClient(List configs, Action configAction) { - this.db = new SqlSugarClient(configs); - this.configAction = configAction; + _configs = configs; + this._configAction = configAction; } //public ScopedClient(SqlSugarClient context,Action configAction) //{ @@ -44,7 +44,7 @@ namespace SqlSugar get { SqlSugarClient result = null; - var key = db.GetHashCode().ToString(); + var key = _configs.GetHashCode().ToString(); StackTrace st = new StackTrace(true); var methods = st.GetFrames(); var isAsync = UtilMethods.IsAnyAsyncMethod(methods); @@ -65,11 +65,11 @@ namespace SqlSugar SqlSugarClient result = CallContextAsync.GetData(key); if (result == null) { - CallContextAsync.SetData(key, new SqlSugarClient(db._allConfigs)); + CallContextAsync.SetData(key, new SqlSugarClient(_configs)); result = CallContextAsync.GetData(key); - if (this.configAction != null) + if (this._configAction != null) { - this.configAction(result); + this._configAction(result); } } @@ -81,11 +81,11 @@ namespace SqlSugar SqlSugarClient result = CallContextThread.GetData(key); if (result == null) { - CallContextThread.SetData(key, new SqlSugarClient(db._allConfigs)); + CallContextThread.SetData(key, new SqlSugarClient(_configs)); result = CallContextThread.GetData(key); - if (this.configAction != null) + if (this._configAction != null) { - this.configAction(result); + this._configAction(result); } } return result;