mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-07 18:04:55 +08:00
CodeFirst support for external transactions
This commit is contained in:
@@ -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>()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user