Browse Source

Optimize the code

pull/19/head
sunkaixuan 2 years ago
parent
commit
6a3b1d32d7
  1. 1
      Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs

1
Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs

@ -320,6 +320,7 @@ namespace SqlSugar
}
public IInsertable<T> IgnoreColumns(Expression<Func<T, object>> columns)
{
if (columns == null) return this;
var ignoreColumns = InsertBuilder.GetExpressionValue(columns, ResolveExpressType.ArraySingle).GetResultArray().Select(it => this.SqlBuilder.GetNoTranslationColumnName(it)).ToList();
this.InsertBuilder.DbColumnInfoList = this.InsertBuilder.DbColumnInfoList.Where(it => !ignoreColumns.Any(ig => ig.Equals(it.PropertyName, StringComparison.CurrentCultureIgnoreCase))).ToList();
this.InsertBuilder.DbColumnInfoList = this.InsertBuilder.DbColumnInfoList.Where(it => !ignoreColumns.Any(ig => ig.Equals(it.DbColumnName, StringComparison.CurrentCultureIgnoreCase))).ToList();

Loading…
Cancel
Save