diff --git a/Src/Asp.Net/SqlSugar/SugarUnitOfWork.cs b/Src/Asp.Net/SqlSugar/SugarUnitOfWork.cs index 0775debb1..5bee50c63 100644 --- a/Src/Asp.Net/SqlSugar/SugarUnitOfWork.cs +++ b/Src/Asp.Net/SqlSugar/SugarUnitOfWork.cs @@ -39,7 +39,7 @@ namespace SqlSugar { this.Tenant.RollbackTran(); } - if (IsClose == false) + if (this.Db.Ado.Transaction==null&&IsClose == false) { this.Db.Close(); } @@ -81,7 +81,7 @@ namespace SqlSugar this.Tenant.CommitTran(); IsCommit = true; } - if (this.IsClose == false) + if (this.Db.Ado.Transaction==null&&this.IsClose == false) { this.Db.Close(); IsClose = true;