|
|
@ -24,6 +24,10 @@ namespace SqlSugar |
|
|
|
{ |
|
|
|
parentPkColumn = parentNavColumn; |
|
|
|
} |
|
|
|
if (ParentIsPk(parentNavigateProperty)) |
|
|
|
{ |
|
|
|
parentPkColumn = this._ParentEntity.Columns.FirstOrDefault(it => it.IsPrimarykey); |
|
|
|
} |
|
|
|
foreach (var item in parentList) |
|
|
|
{ |
|
|
|
var parentValue = parentPkColumn.PropertyInfo.GetValue(item); |
|
|
@ -42,6 +46,14 @@ namespace SqlSugar |
|
|
|
SetNewParent<TChild>(thisEntity, thisPkColumn); |
|
|
|
} |
|
|
|
|
|
|
|
private static bool ParentIsPk(EntityColumnInfo parentNavigateProperty) |
|
|
|
{ |
|
|
|
return parentNavigateProperty != null && |
|
|
|
parentNavigateProperty.Navigat != null && |
|
|
|
parentNavigateProperty.Navigat.NavigatType == NavigateType.OneToMany && |
|
|
|
parentNavigateProperty.Navigat.Name2==null; |
|
|
|
} |
|
|
|
|
|
|
|
private EntityColumnInfo GetParentPkColumn() |
|
|
|
{ |
|
|
|
EntityColumnInfo parentPkColumn = _ParentPkColumn; |
|
|
|