- 修复 IInsert/IUpdate BatchProgress 异步执行不生效的 bug;

This commit is contained in:
28810 2020-08-05 09:41:25 +08:00
parent db42c5cd9d
commit dcb4fef9e2
2 changed files with 18 additions and 3 deletions

View File

@ -27,6 +27,7 @@ namespace FreeSql.Internal.CommonProvider
}
if (ss.Length == 1)
{
_batchProgress?.Invoke(new BatchProgressStatus<T1>(_source, 1, 1));
ret = await this.RawExecuteAffrowsAsync();
ClearData();
return ret;
@ -44,6 +45,7 @@ namespace FreeSql.Internal.CommonProvider
for (var a = 0; a < ss.Length; a++)
{
_source = ss[a];
_batchProgress?.Invoke(new BatchProgressStatus<T1>(_source, a + 1, ss.Length));
ret += await this.RawExecuteAffrowsAsync();
}
}
@ -59,6 +61,7 @@ namespace FreeSql.Internal.CommonProvider
for (var a = 0; a < ss.Length; a++)
{
_source = ss[a];
_batchProgress?.Invoke(new BatchProgressStatus<T1>(_source, a + 1, ss.Length));
ret += await this.RawExecuteAffrowsAsync();
}
_transaction.Commit();
@ -99,6 +102,7 @@ namespace FreeSql.Internal.CommonProvider
}
if (ss.Length == 1)
{
_batchProgress?.Invoke(new BatchProgressStatus<T1>(_source, 1, 1));
ret = await this.RawExecuteIdentityAsync();
ClearData();
return ret;
@ -116,6 +120,7 @@ namespace FreeSql.Internal.CommonProvider
for (var a = 0; a < ss.Length; a++)
{
_source = ss[a];
_batchProgress?.Invoke(new BatchProgressStatus<T1>(_source, a + 1, ss.Length));
if (a < ss.Length - 1) await this.RawExecuteAffrowsAsync();
else ret = await this.RawExecuteIdentityAsync();
}
@ -132,6 +137,7 @@ namespace FreeSql.Internal.CommonProvider
for (var a = 0; a < ss.Length; a++)
{
_source = ss[a];
_batchProgress?.Invoke(new BatchProgressStatus<T1>(_source, a + 1, ss.Length));
if (a < ss.Length - 1) await this.RawExecuteAffrowsAsync();
else ret = await this.RawExecuteIdentityAsync();
}
@ -173,6 +179,7 @@ namespace FreeSql.Internal.CommonProvider
}
if (ss.Length == 1)
{
_batchProgress?.Invoke(new BatchProgressStatus<T1>(_source, 1, 1));
ret = await this.RawExecuteInsertedAsync();
ClearData();
return ret;
@ -190,6 +197,7 @@ namespace FreeSql.Internal.CommonProvider
for (var a = 0; a < ss.Length; a++)
{
_source = ss[a];
_batchProgress?.Invoke(new BatchProgressStatus<T1>(_source, a + 1, ss.Length));
ret.AddRange(await this.RawExecuteInsertedAsync());
}
}
@ -205,6 +213,7 @@ namespace FreeSql.Internal.CommonProvider
for (var a = 0; a < ss.Length; a++)
{
_source = ss[a];
_batchProgress?.Invoke(new BatchProgressStatus<T1>(_source, a + 1, ss.Length));
ret.AddRange(await this.RawExecuteInsertedAsync());
}
_transaction.Commit();

View File

@ -23,6 +23,7 @@ namespace FreeSql.Internal.CommonProvider
var ret = 0;
if (ss.Length <= 1)
{
if (_source?.Any() == true) _batchProgress?.Invoke(new BatchProgressStatus<T1>(_source, 1, 1));
ret = await this.RawExecuteAffrowsAsync();
ClearData();
return ret;
@ -40,6 +41,7 @@ namespace FreeSql.Internal.CommonProvider
for (var a = 0; a < ss.Length; a++)
{
_source = ss[a];
_batchProgress?.Invoke(new BatchProgressStatus<T1>(_source, a + 1, ss.Length));
ret += await this.RawExecuteAffrowsAsync();
}
}
@ -55,6 +57,7 @@ namespace FreeSql.Internal.CommonProvider
for (var a = 0; a < ss.Length; a++)
{
_source = ss[a];
_batchProgress?.Invoke(new BatchProgressStatus<T1>(_source, a + 1, ss.Length));
ret += await this.RawExecuteAffrowsAsync();
}
_transaction.Commit();
@ -89,6 +92,7 @@ namespace FreeSql.Internal.CommonProvider
var ret = new List<T1>();
if (ss.Length <= 1)
{
if (_source?.Any() == true) _batchProgress?.Invoke(new BatchProgressStatus<T1>(_source, 1, 1));
ret = await this.RawExecuteUpdatedAsync();
ClearData();
return ret;
@ -106,6 +110,7 @@ namespace FreeSql.Internal.CommonProvider
for (var a = 0; a < ss.Length; a++)
{
_source = ss[a];
_batchProgress?.Invoke(new BatchProgressStatus<T1>(_source, a + 1, ss.Length));
ret.AddRange(await this.RawExecuteUpdatedAsync());
}
}
@ -121,6 +126,7 @@ namespace FreeSql.Internal.CommonProvider
for (var a = 0; a < ss.Length; a++)
{
_source = ss[a];
_batchProgress?.Invoke(new BatchProgressStatus<T1>(_source, a + 1, ss.Length));
ret.AddRange(await this.RawExecuteUpdatedAsync());
}
_transaction.Commit();