diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/ExecuteNavProvider/InsertNavProviderManyToMany.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/ExecuteNavProvider/InsertNavProviderManyToMany.cs index 308b8a892..ee9dbc696 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/ExecuteNavProvider/InsertNavProviderManyToMany.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/ExecuteNavProvider/InsertNavProviderManyToMany.cs @@ -38,6 +38,10 @@ namespace SqlSugar foreach (var item in parentList) { var items= parentNavigateProperty.PropertyInfo.GetValue(item); + if (items == null) + { + continue; + } var children=((List)items); InsertDatas(children, thisPkColumn); var parentId = parentPkColumn.PropertyInfo.GetValue(item); diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/UpdateProvider/UpdateableHelper.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/UpdateProvider/UpdateableHelper.cs index 059077283..f3efc69fe 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/UpdateProvider/UpdateableHelper.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/UpdateProvider/UpdateableHelper.cs @@ -464,7 +464,7 @@ namespace SqlSugar it.PropertyName.EqualCase(verColumn.PropertyName)); if (data == null) { - data = new DbColumnInfo() { DbColumnName= verColumn.DbColumnName, Value=newValue }; + data = new DbColumnInfo() { DbColumnName= verColumn.DbColumnName,PropertyName=verColumn.PropertyName, Value=newValue }; this.UpdateBuilder.DbColumnInfoList.Add(data); } data.Value = newValue;