mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-05 03:17:41 +08:00
Synchronization code
This commit is contained in:
@@ -51,7 +51,20 @@ namespace SqlSugar
|
|||||||
public async virtual Task<int> Merge<T>(string tableName,DataTable dt, EntityInfo entityInfo, string[] whereColumns, string[] updateColumns, List<T> datas) where T : class, new()
|
public async virtual Task<int> Merge<T>(string tableName,DataTable dt, EntityInfo entityInfo, string[] whereColumns, string[] updateColumns, List<T> datas) where T : class, new()
|
||||||
{
|
{
|
||||||
var result = 0;
|
var result = 0;
|
||||||
await this.Context.Utilities.PageEachAsync(datas,2000,async pageItems =>
|
var pageSize = 2000;
|
||||||
|
if (dt.Columns.Count > 100)
|
||||||
|
{
|
||||||
|
pageSize = 100;
|
||||||
|
}
|
||||||
|
else if (dt.Columns.Count > 50)
|
||||||
|
{
|
||||||
|
pageSize = 300;
|
||||||
|
}
|
||||||
|
else if (dt.Columns.Count > 30)
|
||||||
|
{
|
||||||
|
pageSize = 500;
|
||||||
|
}
|
||||||
|
await this.Context.Utilities.PageEachAsync(datas, pageSize, async pageItems =>
|
||||||
{
|
{
|
||||||
var x = await this.Context.Storageable(pageItems).As(tableName).WhereColumns(whereColumns).ToStorageAsync();
|
var x = await this.Context.Storageable(pageItems).As(tableName).WhereColumns(whereColumns).ToStorageAsync();
|
||||||
result += await x.BulkCopyAsync();
|
result += await x.BulkCopyAsync();
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
public QueryMethodInfo AddJoinInfo(Type joinEntityType, string shortName, string onWhere, JoinType type = JoinType.Left)
|
public QueryMethodInfo AddJoinInfo(Type joinEntityType, string shortName, string onWhere, JoinType type = JoinType.Left)
|
||||||
{
|
{
|
||||||
var method = QueryableObj.GetType().GetMyMethod("AddJoinInfo", 4, typeof(string), typeof(string), typeof(string), typeof(JoinType));
|
var method = QueryableObj.GetType().GetMyMethod("AddJoinInfo", 4, typeof(Type), typeof(string), typeof(string), typeof(JoinType));
|
||||||
this.QueryableObj = method.Invoke(QueryableObj, new object[] { this.Context.EntityMaintenance.GetTableName(joinEntityType), shortName, onWhere, type });
|
this.QueryableObj = method.Invoke(QueryableObj, new object[] { joinEntityType, shortName, onWhere, type });
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public QueryMethodInfo GroupBy(List<GroupByModel> models)
|
public QueryMethodInfo GroupBy(List<GroupByModel> models)
|
||||||
|
|||||||
Reference in New Issue
Block a user