Update db.Fastest

This commit is contained in:
sunkaixuan
2022-05-30 19:19:52 +08:00
parent 4d55dace23
commit ebde9695a6
2 changed files with 13 additions and 0 deletions

View File

@@ -29,6 +29,11 @@ namespace SqlSugar
Check.ExceptionEasy(this.AsName.IsNullOrEmpty(), "need .AS(tablaeName) ", "需要 .AS(tablaeName) 设置表名"); Check.ExceptionEasy(this.AsName.IsNullOrEmpty(), "need .AS(tablaeName) ", "需要 .AS(tablaeName) 设置表名");
return BulkCopyAsync(this.AsName, dt).ConfigureAwait(true).GetAwaiter().GetResult(); return BulkCopyAsync(this.AsName, dt).ConfigureAwait(true).GetAwaiter().GetResult();
} }
public Task<int> BulkCopyAsync(DataTable dt)
{
Check.ExceptionEasy(this.AsName.IsNullOrEmpty(), "need .AS(tablaeName) ", "需要 .AS(tablaeName) 设置表名");
return BulkCopyAsync(this.AsName, dt);
}
public async Task<int> BulkCopyAsync(string tableName, DataTable dt) public async Task<int> BulkCopyAsync(string tableName, DataTable dt)
{ {
if (Size > 0) if (Size > 0)
@@ -115,6 +120,12 @@ namespace SqlSugar
Check.ExceptionEasy(this.AsName.IsNullOrEmpty(), "need .AS(tablaeName) ", "需要 .AS(tablaeName) 设置表名"); Check.ExceptionEasy(this.AsName.IsNullOrEmpty(), "need .AS(tablaeName) ", "需要 .AS(tablaeName) 设置表名");
return BulkUpdateAsync(this.AsName, dataTable, whereColumns, updateColumns).ConfigureAwait(true).GetAwaiter().GetResult(); return BulkUpdateAsync(this.AsName, dataTable, whereColumns, updateColumns).ConfigureAwait(true).GetAwaiter().GetResult();
} }
public Task<int> BulkUpdateAsync(DataTable dataTable, string[] whereColumns)
{
string[] updateColumns = dataTable.Columns.Cast<DataColumn>().Select(it => it.ColumnName).Where(it => !whereColumns.Any(z => z.EqualCase(it))).ToArray();
Check.ExceptionEasy(this.AsName.IsNullOrEmpty(), "need .AS(tablaeName) ", "需要 .AS(tablaeName) 设置表名");
return BulkUpdateAsync(this.AsName, dataTable, whereColumns, updateColumns);
}
public async Task<int> BulkUpdateAsync(string tableName, DataTable dataTable, string[] whereColumns, string[] updateColumns) public async Task<int> BulkUpdateAsync(string tableName, DataTable dataTable, string[] whereColumns, string[] updateColumns)
{ {

View File

@@ -18,6 +18,7 @@ namespace SqlSugar
int BulkCopy(string tableName,DataTable dataTable); int BulkCopy(string tableName,DataTable dataTable);
int BulkCopy(DataTable dataTable); int BulkCopy(DataTable dataTable);
Task<int> BulkCopyAsync(string tableName, DataTable dataTable); Task<int> BulkCopyAsync(string tableName, DataTable dataTable);
Task<int> BulkCopyAsync(DataTable dataTable);
int BulkUpdate(List<T> datas); int BulkUpdate(List<T> datas);
Task<int> BulkUpdateAsync(List<T> datas); Task<int> BulkUpdateAsync(List<T> datas);
@@ -27,6 +28,7 @@ namespace SqlSugar
int BulkUpdate(DataTable dataTable, string[] whereColumns, string[] updateColumns); int BulkUpdate(DataTable dataTable, string[] whereColumns, string[] updateColumns);
int BulkUpdate(DataTable dataTable, string[] whereColumns); int BulkUpdate(DataTable dataTable, string[] whereColumns);
Task<int> BulkUpdateAsync(string tableName, DataTable dataTable, string[] whereColumns, string[] updateColumns); Task<int> BulkUpdateAsync(string tableName, DataTable dataTable, string[] whereColumns, string[] updateColumns);
Task<int> BulkUpdateAsync(DataTable dataTable, string[] whereColumns);
SplitFastest<T> SplitTable(); SplitFastest<T> SplitTable();
} }
} }