From 8ac68c1270b4218d965b3f65483949f98a083b91 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Sat, 26 Nov 2022 16:45:33 +0800 Subject: [PATCH] Synchronization code --- Src/Asp.NetCore2/SqlSugar/Interface/ITenant.cs | 2 +- Src/Asp.NetCore2/SqlSugar/SqlSugarClient.cs | 8 ++++---- Src/Asp.NetCore2/SqlSugar/SqlSugarScope.cs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Src/Asp.NetCore2/SqlSugar/Interface/ITenant.cs b/Src/Asp.NetCore2/SqlSugar/Interface/ITenant.cs index c5852b2b0..a04be0227 100644 --- a/Src/Asp.NetCore2/SqlSugar/Interface/ITenant.cs +++ b/Src/Asp.NetCore2/SqlSugar/Interface/ITenant.cs @@ -21,7 +21,7 @@ namespace SqlSugar Task> UseTranAsync(Func> action, Action errorCallBack = null); void AddConnection(ConnectionConfig connection); SqlSugarProvider GetConnection(dynamic configId); - void RemoveConnection(string configId); + void RemoveConnection(dynamic configId); SqlSugarScopeProvider GetConnectionScope(dynamic configId); SqlSugarProvider GetConnectionWithAttr(); SqlSugarScopeProvider GetConnectionScopeWithAttr(); diff --git a/Src/Asp.NetCore2/SqlSugar/SqlSugarClient.cs b/Src/Asp.NetCore2/SqlSugar/SqlSugarClient.cs index b6a966625..3f9e82c65 100644 --- a/Src/Asp.NetCore2/SqlSugar/SqlSugarClient.cs +++ b/Src/Asp.NetCore2/SqlSugar/SqlSugarClient.cs @@ -777,17 +777,17 @@ namespace SqlSugar { return new SqlSugarTransaction(this); } - public void RemoveConnection(string configId) + public void RemoveConnection(dynamic configId) { - var removeData= this._AllClients.FirstOrDefault(it => it.ConnectionConfig.ConfigId.ObjToString()== configId.ObjToString()); - var currentId= this.CurrentConnectionConfig.ConfigId; + var removeData= this._AllClients.FirstOrDefault(it => ((object)it.ConnectionConfig.ConfigId).ObjToString()== ((object)configId).ObjToString()); + object currentId= this.CurrentConnectionConfig.ConfigId; if (removeData != null) { if (removeData.Context.Ado.IsAnyTran()) { Check.ExceptionEasy("RemoveConnection error has tran",$"删除失败{removeData.ConnectionConfig.ConfigId}存在未提交事务"); } - else if (removeData.ConnectionConfig.ConfigId.ObjToString()== currentId.ObjToString()) + else if (((object)removeData.ConnectionConfig.ConfigId).ObjToString()== currentId.ObjToString()) { Check.ExceptionEasy("Default ConfigId cannot be deleted", $"默认库不能删除{removeData.ConnectionConfig.ConfigId}"); } diff --git a/Src/Asp.NetCore2/SqlSugar/SqlSugarScope.cs b/Src/Asp.NetCore2/SqlSugar/SqlSugarScope.cs index 0cc3489d0..f46242b47 100644 --- a/Src/Asp.NetCore2/SqlSugar/SqlSugarScope.cs +++ b/Src/Asp.NetCore2/SqlSugar/SqlSugarScope.cs @@ -793,7 +793,7 @@ namespace SqlSugar { ScopedContext.Tracking(datas); } - public void RemoveConnection(string configId) + public void RemoveConnection(dynamic configId) { ScopedContext.RemoveConnection(configId); }