Update Multi-tenant BUG

This commit is contained in:
sunkaixuan
2022-08-30 16:48:26 +08:00
parent 8fbf189ac5
commit eed32c6bd6

View File

@@ -769,16 +769,16 @@ 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)
{ {
db.Context.CurrentConnectionConfig.AopEvents = new AopEvents(); db.Context.CurrentConnectionConfig.AopEvents = new AopEvents();
} }
if (_IsAllTran && db.Context.Ado.Transaction == null)
{
db.Context.Ado.BeginTran();
}
return db.Context; return db.Context;
} }