From 62fa9cc34e6ec47fe44010697f2105aca52eed49 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Wed, 11 May 2022 16:56:00 +0800 Subject: [PATCH] Update Core --- .../Abstract/InsertableProvider/SplitInsertable.cs | 7 +++++-- .../SqlSugar/IntegrationServices/SplitTableService.cs | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/InsertableProvider/SplitInsertable.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/InsertableProvider/SplitInsertable.cs index 77974e1ae..03c612867 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/InsertableProvider/SplitInsertable.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/InsertableProvider/SplitInsertable.cs @@ -215,8 +215,11 @@ namespace SqlSugar { if (!this.Context.DbMaintenance.IsAnyTable(item.Key, false)) { - this.Context.MappingTables.Add(EntityInfo.EntityName, item.Key); - this.Context.CodeFirst.InitTables(); + if (item.Value != null) + { + this.Context.MappingTables.Add(EntityInfo.EntityName, item.Key); + this.Context.CodeFirst.InitTables(); + } } } this.Context.Ado.IsEnableLogEvent = isLog; diff --git a/Src/Asp.NetCore2/SqlSugar/IntegrationServices/SplitTableService.cs b/Src/Asp.NetCore2/SqlSugar/IntegrationServices/SplitTableService.cs index 22bd9ae57..d2fb6c00c 100644 --- a/Src/Asp.NetCore2/SqlSugar/IntegrationServices/SplitTableService.cs +++ b/Src/Asp.NetCore2/SqlSugar/IntegrationServices/SplitTableService.cs @@ -65,6 +65,10 @@ namespace SqlSugar } else { + if (entityValue == null) + { + return null; + } var value = splitColumn.PropertyInfo.GetValue(entityValue, null); if (value == null) {