mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-08 14:47:59 +08:00
Update DatasTrackingExecommand
This commit is contained in:
parent
1349bf422e
commit
efcd0b5cac
@ -19,9 +19,10 @@ namespace SqlSugar
|
|||||||
private int DatasTrackingExecommand()
|
private int DatasTrackingExecommand()
|
||||||
{
|
{
|
||||||
var trakRows = 0;
|
var trakRows = 0;
|
||||||
|
var isNoTran = this.Context.Ado.IsNoTran();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (this.Context.Ado.IsNoTran())
|
if (isNoTran)
|
||||||
{
|
{
|
||||||
this.Context.Ado.BeginTran();
|
this.Context.Ado.BeginTran();
|
||||||
}
|
}
|
||||||
@ -40,14 +41,14 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
if (this.Context.Ado.IsNoTran())
|
if (isNoTran)
|
||||||
{
|
{
|
||||||
this.Context.Ado.CommitTran();
|
this.Context.Ado.CommitTran();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
if (this.Context.Ado.IsNoTran())
|
if (isNoTran)
|
||||||
{
|
{
|
||||||
this.Context.Ado.RollbackTran();
|
this.Context.Ado.RollbackTran();
|
||||||
}
|
}
|
||||||
@ -57,10 +58,11 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
private async Task<int> DatasTrackingExecommandAsync()
|
private async Task<int> DatasTrackingExecommandAsync()
|
||||||
{
|
{
|
||||||
|
var isNoTran = this.Context.Ado.IsNoTran();
|
||||||
var trakRows = 0;
|
var trakRows = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (this.Context.Ado.IsNoTran())
|
if (isNoTran)
|
||||||
{
|
{
|
||||||
await this.Context.Ado.BeginTranAsync();
|
await this.Context.Ado.BeginTranAsync();
|
||||||
}
|
}
|
||||||
@ -79,14 +81,14 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
if (this.Context.Ado.IsNoTran())
|
if (isNoTran)
|
||||||
{
|
{
|
||||||
await this.Context.Ado.CommitTranAsync();
|
await this.Context.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
if (this.Context.Ado.IsNoTran())
|
if (isNoTran)
|
||||||
{
|
{
|
||||||
await this.Context.Ado.RollbackTranAsync();
|
await this.Context.Ado.RollbackTranAsync();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user