mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +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(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);
|
||||
});
|
||||
Check.Exception(!executeResult.IsSuccess, executeResult.ErrorMessage);
|
||||
}
|
||||
|
||||
}
|
||||
public void InitTables<T>()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user