mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-01 10:10:16 +08:00
Update db.UpdateNav
This commit is contained in:
parent
2eda7d4348
commit
5ec61e410a
@ -24,6 +24,10 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
parentPkColumn = parentNavColumn;
|
parentPkColumn = parentNavColumn;
|
||||||
}
|
}
|
||||||
|
if (ParentIsPk(parentNavigateProperty))
|
||||||
|
{
|
||||||
|
parentPkColumn = this._ParentEntity.Columns.FirstOrDefault(it => it.IsPrimarykey);
|
||||||
|
}
|
||||||
var ids = new List<object>();
|
var ids = new List<object>();
|
||||||
foreach (var item in parentList)
|
foreach (var item in parentList)
|
||||||
{
|
{
|
||||||
@ -48,7 +52,13 @@ namespace SqlSugar
|
|||||||
_NavigateType = null;
|
_NavigateType = null;
|
||||||
SetNewParent<TChild>(thisEntity, thisPkColumn);
|
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 void DeleteMany(EntityInfo thisEntity, List<object> ids,string fkName)
|
private void DeleteMany(EntityInfo thisEntity, List<object> ids,string fkName)
|
||||||
{
|
{
|
||||||
if (_Options == null||_Options.OneToManyDeleteAll==false)
|
if (_Options == null||_Options.OneToManyDeleteAll==false)
|
||||||
|
Loading…
Reference in New Issue
Block a user