From aa860429044cd5216e22601c9a99b4c1ce1cf57f Mon Sep 17 00:00:00 2001 From: SUNKAIXUAN <610262374@qq.com> Date: Thu, 25 Mar 2021 15:57:59 +0800 Subject: [PATCH] SubInsert ChildList.Count==0 bug --- .../SqlSugar/Abstract/InsertableProvider/SubInserable.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/SubInserable.cs b/Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/SubInserable.cs index 40af24fda..87545952f 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/SubInserable.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/SubInserable.cs @@ -166,6 +166,10 @@ namespace SqlSugar child.GetType().GetProperty(subMemberName).SetValue(child, pkValue); } } + if (!(childList as IEnumerable).Any()) + { + continue; + } var type = (childList as IEnumerable).First().GetType(); this.Context.InitMappingInfo(type); var entityInfo = this.Context.EntityMaintenance.GetEntityInfo(type);