mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-15 23:13:42 +08:00
CodeFirst support for external transactions
This commit is contained in:
parent
f71648f1da
commit
ec8b55a8d0
@ -54,11 +54,20 @@ namespace SqlSugar
|
|||||||
Check.Exception(true, "Dbfirst and Codefirst requires system table permissions");
|
Check.Exception(true, "Dbfirst and Codefirst requires system table permissions");
|
||||||
}
|
}
|
||||||
Check.Exception(this.Context.IsSystemTablesConfig, "Please set SqlSugarClent Parameter ConnectionConfig.InitKeyType=InitKeyType.Attribute ");
|
Check.Exception(this.Context.IsSystemTablesConfig, "Please set SqlSugarClent Parameter ConnectionConfig.InitKeyType=InitKeyType.Attribute ");
|
||||||
var executeResult = Context.Ado.UseTran(() =>
|
|
||||||
|
if (this.Context.Ado.Transaction == null)
|
||||||
|
{
|
||||||
|
var executeResult = Context.Ado.UseTran(() =>
|
||||||
|
{
|
||||||
|
Execute(entityType);
|
||||||
|
});
|
||||||
|
Check.Exception(!executeResult.IsSuccess, executeResult.ErrorMessage);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Execute(entityType);
|
Execute(entityType);
|
||||||
});
|
}
|
||||||
Check.Exception(!executeResult.IsSuccess, executeResult.ErrorMessage);
|
|
||||||
}
|
}
|
||||||
public void InitTables<T>()
|
public void InitTables<T>()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user