mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 10:08:19 +08:00
Update db.UpdateNav
This commit is contained in:
@@ -75,7 +75,7 @@ namespace SqlSugar
|
||||
children = children.Distinct().ToList();
|
||||
Check.ExceptionEasy(pkColumn == null, typeof(TChild).Name + " has no primary key", typeof(TChild).Name + "没有主键");
|
||||
var whereName = pkColumn.PropertyName;
|
||||
if (_Options.OneToOneSaveByPrimaryKey&& pkColumn.IsPrimarykey==false)
|
||||
if (_Options?.OneToOneSaveByPrimaryKey==true&& pkColumn.IsPrimarykey==false)
|
||||
{
|
||||
var newPkColumn=this._Context.EntityMaintenance.GetEntityInfo<TChild>().Columns.FirstOrDefault(it => it.IsPrimarykey);
|
||||
if (newPkColumn != null)
|
||||
@@ -115,7 +115,7 @@ namespace SqlSugar
|
||||
{
|
||||
ignoreColumns.AddRange(pk.Select(it=>it.PropertyName));
|
||||
}
|
||||
if (_Options.OneToOneSaveByPrimaryKey)
|
||||
if (_Options?.OneToOneSaveByPrimaryKey==true)
|
||||
{
|
||||
ignoreColumns = ignoreColumns.Where(it => it != whereName).ToList();
|
||||
}
|
||||
|
@@ -115,6 +115,10 @@ namespace SqlSugar
|
||||
{
|
||||
ignoreColumns.AddRange(pk.Select(it=>it.PropertyName));
|
||||
}
|
||||
if (_Options.OneToOneSaveByPrimaryKey)
|
||||
{
|
||||
ignoreColumns = ignoreColumns.Where(it => it != whereName).ToList();
|
||||
}
|
||||
if (IsDeleted)
|
||||
{
|
||||
x.AsUpdateable.IgnoreColumns(ignoreColumns.ToArray()).PageSize(1).EnableQueryFilter().ExecuteCommand();
|
||||
|
Reference in New Issue
Block a user