Update Oracle batch updates

This commit is contained in:
sunkaixuna
2021-08-20 23:59:59 +08:00
parent 5a10604799
commit 91970743d1
2 changed files with 18 additions and 1 deletions

View File

@@ -66,7 +66,7 @@ namespace SqlSugar
{ {
return this.ExecuteCommand() > 0; return this.ExecuteCommand() > 0;
} }
public async Task<int> ExecuteCommandAsync() public virtual async Task<int> ExecuteCommandAsync()
{ {
string sql = _ExecuteCommand(); string sql = _ExecuteCommand();
if (string.IsNullOrEmpty(sql)) if (string.IsNullOrEmpty(sql))

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace SqlSugar namespace SqlSugar
{ {
@@ -27,5 +28,21 @@ namespace SqlSugar
return base.UpdateObjs.Count(); return base.UpdateObjs.Count();
} }
} }
public async override Task<int> ExecuteCommandAsync()
{
if (base.UpdateObjs.Count() == 1)
{
return await base.ExecuteCommandAsync();
}
else if (base.UpdateObjs.Count() == 0)
{
return 0;
}
else
{
await base.ExecuteCommandAsync();
return base.UpdateObjs.Count();
}
}
} }
} }