Support nav update ignorecolums

This commit is contained in:
sunkaixuan
2023-11-25 19:20:33 +08:00
parent c7ba85395b
commit 4e91703056
2 changed files with 8 additions and 2 deletions

View File

@@ -97,6 +97,10 @@ namespace SqlSugar
{
var pk= this._Context.EntityMaintenance.GetEntityInfo<TChild>().Columns.Where(it => it.IsPrimarykey);
List<string> ignoreColumns = new List<string>();
if (_Options?.IgnoreColumns != null)
{
ignoreColumns.AddRange(_Options.IgnoreColumns);
}
if (pk.Any())
{
ignoreColumns.AddRange(pk.Select(it=>it.PropertyName));
@@ -112,13 +116,14 @@ namespace SqlSugar
}
else
{
var ignoreColumns = _Options?.IgnoreColumns;
if (IsDeleted)
{
x.AsUpdateable.PageSize(1).EnableQueryFilter().ExecuteCommand();
x.AsUpdateable.IgnoreColumns(ignoreColumns?.ToArray()).PageSize(1).EnableQueryFilter().ExecuteCommand();
}
else
{
x.AsUpdateable.ExecuteCommand();
x.AsUpdateable.IgnoreColumns(ignoreColumns?.ToArray()).ExecuteCommand();
}
}
InitData(pkColumn, insertData);

View File

@@ -54,6 +54,7 @@ namespace SqlSugar
public bool OneToManyInsertOrUpdate { get; set; }
public Expression RootFunc { get; set; }
public Expression CurrentFunc { get; set; }
public string[] IgnoreColumns { get; set; }
}
public class InsertNavOptions