Synchronization code

This commit is contained in:
sunkaixuan 2022-11-26 16:45:33 +08:00
parent 964da2ea8a
commit 8ac68c1270
3 changed files with 6 additions and 6 deletions

View File

@ -21,7 +21,7 @@ namespace SqlSugar
Task<DbResult<T>> UseTranAsync<T>(Func<Task<T>> action, Action<Exception> errorCallBack = null); Task<DbResult<T>> UseTranAsync<T>(Func<Task<T>> action, Action<Exception> errorCallBack = null);
void AddConnection(ConnectionConfig connection); void AddConnection(ConnectionConfig connection);
SqlSugarProvider GetConnection(dynamic configId); SqlSugarProvider GetConnection(dynamic configId);
void RemoveConnection(string configId); void RemoveConnection(dynamic configId);
SqlSugarScopeProvider GetConnectionScope(dynamic configId); SqlSugarScopeProvider GetConnectionScope(dynamic configId);
SqlSugarProvider GetConnectionWithAttr<T>(); SqlSugarProvider GetConnectionWithAttr<T>();
SqlSugarScopeProvider GetConnectionScopeWithAttr<T>(); SqlSugarScopeProvider GetConnectionScopeWithAttr<T>();

View File

@ -777,17 +777,17 @@ namespace SqlSugar
{ {
return new SqlSugarTransaction(this); 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 removeData= this._AllClients.FirstOrDefault(it => ((object)it.ConnectionConfig.ConfigId).ObjToString()== ((object)configId).ObjToString());
var currentId= this.CurrentConnectionConfig.ConfigId; object currentId= this.CurrentConnectionConfig.ConfigId;
if (removeData != null) if (removeData != null)
{ {
if (removeData.Context.Ado.IsAnyTran()) if (removeData.Context.Ado.IsAnyTran())
{ {
Check.ExceptionEasy("RemoveConnection error has tran",$"删除失败{removeData.ConnectionConfig.ConfigId}存在未提交事务"); 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}"); Check.ExceptionEasy("Default ConfigId cannot be deleted", $"默认库不能删除{removeData.ConnectionConfig.ConfigId}");
} }

View File

@ -793,7 +793,7 @@ namespace SqlSugar
{ {
ScopedContext.Tracking(datas); ScopedContext.Tracking(datas);
} }
public void RemoveConnection(string configId) public void RemoveConnection(dynamic configId)
{ {
ScopedContext.RemoveConnection(configId); ScopedContext.RemoveConnection(configId);
} }