mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 16:18:47 +08:00
Optimize SplitTable BulkCopy
This commit is contained in:
parent
d80cf462f1
commit
4ec6f1d999
@ -54,6 +54,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
SplitFastest<T> result = new SplitFastest<T>();
|
SplitFastest<T> result = new SplitFastest<T>();
|
||||||
result.FastestProvider = this;
|
result.FastestProvider = this;
|
||||||
|
result.PageSize = this.Size;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,9 @@ namespace SqlSugar
|
|||||||
public FastestProvider<T> FastestProvider { get; set; }
|
public FastestProvider<T> FastestProvider { get; set; }
|
||||||
public SqlSugarProvider Context { get { return this.FastestProvider.context; } }
|
public SqlSugarProvider Context { get { return this.FastestProvider.context; } }
|
||||||
public EntityInfo EntityInfo { get { return this.Context.EntityMaintenance.GetEntityInfo<T>(); } }
|
public EntityInfo EntityInfo { get { return this.Context.EntityMaintenance.GetEntityInfo<T>(); } }
|
||||||
|
|
||||||
|
public int PageSize { get; internal set; }
|
||||||
|
|
||||||
public int BulkCopy(List<T> datas)
|
public int BulkCopy(List<T> datas)
|
||||||
{
|
{
|
||||||
List<GroupModel> groupModels;
|
List<GroupModel> groupModels;
|
||||||
@ -21,7 +24,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
CreateTable(item.Key);
|
CreateTable(item.Key);
|
||||||
var addList = item.Select(it => it.Item).ToList();
|
var addList = item.Select(it => it.Item).ToList();
|
||||||
result += FastestProvider.AS(item.Key).BulkCopy(addList);
|
result += FastestProvider.AS(item.Key).PageSize(this.PageSize).BulkCopy(addList);
|
||||||
this.Context.MappingTables.Add(EntityInfo.EntityName, EntityInfo.DbTableName);
|
this.Context.MappingTables.Add(EntityInfo.EntityName, EntityInfo.DbTableName);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -51,7 +54,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
CreateTable(item.Key);
|
CreateTable(item.Key);
|
||||||
var addList = item.Select(it => it.Item).ToList();
|
var addList = item.Select(it => it.Item).ToList();
|
||||||
result += FastestProvider.AS(item.Key).BulkUpdate(addList);
|
result += FastestProvider.AS(item.Key).PageSize(this.PageSize).BulkUpdate(addList);
|
||||||
this.Context.MappingTables.Add(EntityInfo.EntityName, EntityInfo.DbTableName);
|
this.Context.MappingTables.Add(EntityInfo.EntityName, EntityInfo.DbTableName);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user