From 99b8259d0b34cb42b5d1bf92e8ccb6eadec6bf89 Mon Sep 17 00:00:00 2001 From: sunkaixuna <610262374@qq.com> Date: Thu, 11 Nov 2021 17:45:45 +0800 Subject: [PATCH] Optimize multi-tenant transactions --- Src/Asp.Net/SqlSugar/SqlSugarClient.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Src/Asp.Net/SqlSugar/SqlSugarClient.cs b/Src/Asp.Net/SqlSugar/SqlSugarClient.cs index 097944cd2..47c5e702f 100644 --- a/Src/Asp.Net/SqlSugar/SqlSugarClient.cs +++ b/Src/Asp.Net/SqlSugar/SqlSugarClient.cs @@ -620,6 +620,10 @@ namespace SqlSugar if (db.Context == null) { db.Context = new SqlSugarProvider(db.ConnectionConfig); + if (_IsAllTran&&db.Context.Ado.Transaction==null) + { + db.Context.Ado.BeginTran(); + } } var intiAop=db.Context.Aop; if (db.Context.CurrentConnectionConfig.AopEvents == null)