Update split table

This commit is contained in:
sunkaixuna
2021-12-18 14:47:45 +08:00
parent b44bb8453a
commit a10e28652c
4 changed files with 12 additions and 8 deletions

View File

@@ -78,6 +78,7 @@ namespace OrmTest
}); });
db.Fastest<OrderSpliteTest>().SplitTable().BulkUpdate(db.Queryable<OrderSpliteTest>().SplitTable(it=>it).ToList()); db.Fastest<OrderSpliteTest>().SplitTable().BulkUpdate(db.Queryable<OrderSpliteTest>().SplitTable(it=>it).ToList());
db.Fastest<OrderSpliteTest>().SplitTable().BulkUpdate(db.Queryable<OrderSpliteTest>().SplitTable(it => it).ToList(),new string[] { "pk"},new string[] { "name"});
Console.WriteLine("#### CodeFirst end ####"); Console.WriteLine("#### CodeFirst end ####");
} }

View File

@@ -116,7 +116,7 @@ namespace SqlSugar
this.context.Ado.IsEnableLogEvent = isLog; this.context.Ado.IsEnableLogEvent = isLog;
if (this.context.CurrentConnectionConfig?.AopEvents?.OnLogExecuted != null) if (this.context.CurrentConnectionConfig?.AopEvents?.OnLogExecuted != null)
{ {
this.context.CurrentConnectionConfig?.AopEvents?.OnLogExecuted($"End {title} name:{entityInfo.DbTableName} ,count: {datas.Count},current time: {DateTime.Now}" , new SugarParameter[] { }); this.context.CurrentConnectionConfig?.AopEvents?.OnLogExecuted($"End {title} name:{GetTableName()} ,count: {datas.Count},current time: {DateTime.Now}" , new SugarParameter[] { });
} }
} }
@@ -127,7 +127,7 @@ namespace SqlSugar
this.context.Ado.IsEnableLogEvent = false; this.context.Ado.IsEnableLogEvent = false;
if (this.context.CurrentConnectionConfig?.AopEvents?.OnLogExecuting != null) if (this.context.CurrentConnectionConfig?.AopEvents?.OnLogExecuting != null)
{ {
this.context.CurrentConnectionConfig?.AopEvents?.OnLogExecuting($"Begin {title} name:{entityInfo.DbTableName} ,count: {datas.Count},current time: {DateTime.Now} ", new SugarParameter[] { }); this.context.CurrentConnectionConfig?.AopEvents?.OnLogExecuting($"Begin {title} name:{GetTableName()} ,count: {datas.Count},current time: {DateTime.Now} ", new SugarParameter[] { });
} }
} }
#endregion #endregion

View File

@@ -94,7 +94,7 @@ namespace SqlSugar
} }
else else
{ {
return queryable.SqlBuilder.GetTranslationTableName(entityInfo.DbTableName); return queryable.SqlBuilder.GetTranslationTableName(this.context.EntityMaintenance.GetTableName<T>());
} }
} }
private object ValueConverter(EntityColumnInfo columnInfo, object value) private object ValueConverter(EntityColumnInfo columnInfo, object value)

View File

@@ -21,7 +21,8 @@ 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).BulkCopy(addList);
this.Context.MappingTables.Add(EntityInfo.EntityName, EntityInfo.DbTableName);
} }
return result; return result;
} }
@@ -34,7 +35,8 @@ 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 +=await FastestProvider.AS(item.Key).BulkCopyAsync(addList); ; result +=await FastestProvider.AS(item.Key).BulkCopyAsync(addList);
this.Context.MappingTables.Add(EntityInfo.EntityName, EntityInfo.DbTableName);
} }
return result; return result;
} }
@@ -49,7 +51,8 @@ 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).BulkUpdate(addList);
this.Context.MappingTables.Add(EntityInfo.EntityName, EntityInfo.DbTableName);
} }
return result; return result;
} }
@@ -62,7 +65,8 @@ 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 += await FastestProvider.AS(item.Key).BulkUpdateAsync(addList); ; result += await FastestProvider.AS(item.Key).BulkUpdateAsync(addList);
this.Context.MappingTables.Add(EntityInfo.EntityName, EntityInfo.DbTableName);
} }
return result; return result;
} }
@@ -102,7 +106,6 @@ namespace SqlSugar
this.Context.CodeFirst.InitTables<T>(); this.Context.CodeFirst.InitTables<T>();
} }
this.Context.Ado.IsEnableLogEvent = isLog; this.Context.Ado.IsEnableLogEvent = isLog;
this.Context.MappingTables.Add(EntityInfo.EntityName, EntityInfo.DbTableName);
} }
private void GroupDataList(List<T> datas, out List<GroupModel> groupModels, out int result) private void GroupDataList(List<T> datas, out List<GroupModel> groupModels, out int result)