Optimized code

This commit is contained in:
sunkaixuan
2024-01-09 11:30:43 +08:00
parent 8640c8af7d
commit a020ae7bf8

View File

@@ -208,6 +208,8 @@ namespace SqlSugar
}
private async Task<int> _BulkMerge(List<T> datas, string[] updateColumns, string[] whereColumns)
{
try
{
Begin(datas, false, true);
Check.Exception(whereColumns == null || whereColumns.Count() == 0, "where columns count=0 or need primary key");
@@ -234,10 +236,18 @@ namespace SqlSugar
End(datas, false, true);
return result;
}
catch (Exception)
{
this.context.Close();
throw;
}
}
#endregion
#region Core
private async Task<int> _BulkUpdate(List<T> datas, string[] whereColumns, string[] updateColumns)
{
try
{
Begin(datas, false);
Check.Exception(whereColumns == null || whereColumns.Count() == 0, "where columns count=0 or need primary key");
@@ -261,6 +271,12 @@ namespace SqlSugar
End(datas, false);
return result;
}
catch (Exception)
{
this.context.Close();
throw;
}
}
private void ActionIgnoreColums(string[] whereColumns, string[] updateColumns, DataTable dt,bool IsActionUpdateColumns)
{