Synchronization code

This commit is contained in:
sunkaixuan
2024-04-24 11:37:24 +08:00
parent 0da8a65afa
commit 4e6c29112e

View File

@@ -73,7 +73,8 @@ namespace SqlSugar
private void InsertDatas<TChild>(List<TChild> children, EntityColumnInfo pkColumn, EntityColumnInfo NavColumn = null) where TChild : class, new()
{
children = children.Distinct().ToList();
var x = this._Context.Storageable(children).WhereColumns(new string[] { pkColumn.PropertyName }).ToStorage();
Check.ExceptionEasy(pkColumn == null, typeof(TChild).Name + " has no primary key", typeof(TChild).Name + "没有主键");
; var x = this._Context.Storageable(children).WhereColumns(new string[] { pkColumn.PropertyName }).ToStorage();
var insertData = x.InsertList.Select(it => it.Item).ToList();
var updateData = x.UpdateList.Select(it => it.Item).ToList();
Check.ExceptionEasy(pkColumn == null && NavColumn == null, $"The entity is invalid", $"实体错误无法使用导航");