Optimize multi-tenant transactions

This commit is contained in:
sunkaixuna
2021-11-11 17:45:45 +08:00
parent 55f834dabe
commit 99b8259d0b

View File

@@ -620,6 +620,10 @@ namespace SqlSugar
if (db.Context == null) if (db.Context == null)
{ {
db.Context = new SqlSugarProvider(db.ConnectionConfig); db.Context = new SqlSugarProvider(db.ConnectionConfig);
if (_IsAllTran&&db.Context.Ado.Transaction==null)
{
db.Context.Ado.BeginTran();
}
} }
var intiAop=db.Context.Aop; var intiAop=db.Context.Aop;
if (db.Context.CurrentConnectionConfig.AopEvents == null) if (db.Context.CurrentConnectionConfig.AopEvents == null)