mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-25 01:14:33 +08:00
Synchronization code
This commit is contained in:
parent
3b86123ce7
commit
df352b8b6b
@ -41,18 +41,24 @@ namespace SqlSugar
|
|||||||
children.AddRange(childs);
|
children.AddRange(childs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var isTreeChild = GetIsTreeChild(parentEntity, thisEntity);
|
||||||
Check.ExceptionEasy(thisPkColumn == null, $"{thisEntity.EntityName}need primary key", $"实体{thisEntity.EntityName}需要主键");
|
Check.ExceptionEasy(thisPkColumn == null, $"{thisEntity.EntityName}need primary key", $"实体{thisEntity.EntityName}需要主键");
|
||||||
if (NotAny(name))
|
if (NotAny(name) || isTreeChild)
|
||||||
{
|
{
|
||||||
InsertDatas(children, thisPkColumn);
|
InsertDatas(children, thisPkColumn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this._ParentList = children.Cast<object>().ToList();
|
this._ParentList = children.Cast<object>().ToList();
|
||||||
}
|
}
|
||||||
SetNewParent<TChild>(thisEntity, thisPkColumn);
|
SetNewParent<TChild>(thisEntity, thisPkColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool GetIsTreeChild(EntityInfo parentEntity , EntityInfo thisEntity)
|
||||||
|
{
|
||||||
|
return this.NavContext?.Items?.Any() == true && parentEntity.Type == thisEntity.Type;
|
||||||
|
}
|
||||||
|
|
||||||
private static bool ParentIsPk(EntityColumnInfo parentNavigateProperty)
|
private static bool ParentIsPk(EntityColumnInfo parentNavigateProperty)
|
||||||
{
|
{
|
||||||
return parentNavigateProperty != null &&
|
return parentNavigateProperty != null &&
|
||||||
|
Loading…
Reference in New Issue
Block a user