mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Update RemoveConnection
This commit is contained in:
parent
1c210f048d
commit
964da2ea8a
@ -21,7 +21,7 @@ namespace SqlSugar
|
||||
Task<DbResult<T>> UseTranAsync<T>(Func<Task<T>> action, Action<Exception> errorCallBack = null);
|
||||
void AddConnection(ConnectionConfig connection);
|
||||
SqlSugarProvider GetConnection(dynamic configId);
|
||||
void RemoveConnection(string configId);
|
||||
void RemoveConnection(dynamic configId);
|
||||
SqlSugarScopeProvider GetConnectionScope(dynamic configId);
|
||||
SqlSugarProvider GetConnectionWithAttr<T>();
|
||||
SqlSugarScopeProvider GetConnectionScopeWithAttr<T>();
|
||||
|
@ -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}");
|
||||
}
|
||||
|
@ -793,7 +793,7 @@ namespace SqlSugar
|
||||
{
|
||||
ScopedContext.Tracking(datas);
|
||||
}
|
||||
public void RemoveConnection(string configId)
|
||||
public void RemoveConnection(dynamic configId)
|
||||
{
|
||||
ScopedContext.RemoveConnection(configId);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user