diff --git a/FreeSql/FreeSql.xml b/FreeSql/FreeSql.xml
index f52a399d..6ba2f4df 100644
--- a/FreeSql/FreeSql.xml
+++ b/FreeSql/FreeSql.xml
@@ -1616,7 +1616,7 @@
忽略的列
-
+ 属性名,或者字段名
@@ -1630,7 +1630,7 @@
指定的列
-
+ 属性名,或者字段名
diff --git a/FreeSql/Interface/Curd/IUpdate.cs b/FreeSql/Interface/Curd/IUpdate.cs
index 26f11dd8..857b6169 100644
--- a/FreeSql/Interface/Curd/IUpdate.cs
+++ b/FreeSql/Interface/Curd/IUpdate.cs
@@ -49,7 +49,7 @@ namespace FreeSql
///
/// 忽略的列
///
- ///
+ /// 属性名,或者字段名
///
IUpdate IgnoreColumns(string[] columns);
@@ -62,7 +62,7 @@ namespace FreeSql
///
/// 指定的列
///
- ///
+ /// 属性名,或者字段名
///
IUpdate UpdateColumns(string[] columns);
diff --git a/FreeSql/Internal/CommonProvider/UpdateProvider.cs b/FreeSql/Internal/CommonProvider/UpdateProvider.cs
index a4866392..e29c443a 100644
--- a/FreeSql/Internal/CommonProvider/UpdateProvider.cs
+++ b/FreeSql/Internal/CommonProvider/UpdateProvider.cs
@@ -368,27 +368,16 @@ namespace FreeSql.Internal.CommonProvider
public abstract List ExecuteUpdated();
public abstract Task> ExecuteUpdatedAsync();
- public IUpdate IgnoreColumns(Expression> columns)
- {
- var cols = _commonExpression.ExpressionSelectColumns_MemberAccess_New_NewArrayInit(null, columns?.Body, false, null).Distinct();
- _ignore.Clear();
- foreach (var col in cols) _ignore.Add(col, true);
- return this;
- }
- public IUpdate UpdateColumns(Expression> columns)
- {
- var cols = _commonExpression.ExpressionSelectColumns_MemberAccess_New_NewArrayInit(null, columns?.Body, false, null).ToDictionary(a => a, a => true);
- _ignore.Clear();
- foreach (var col in _table.Columns.Values)
- if (cols.ContainsKey(col.Attribute.Name) == false)
- _ignore.Add(col.Attribute.Name, true);
- return this;
- }
+ public IUpdate IgnoreColumns(Expression> columns) => IgnoreColumns(_commonExpression.ExpressionSelectColumns_MemberAccess_New_NewArrayInit(null, columns?.Body, false, null));
+ public IUpdate UpdateColumns(Expression> columns) => UpdateColumns(_commonExpression.ExpressionSelectColumns_MemberAccess_New_NewArrayInit(null, columns?.Body, false, null));
public IUpdate IgnoreColumns(string[] columns)
{
+ var cols = columns.ToDictionary(a => a);
_ignore.Clear();
- foreach (var col in columns) _ignore.Add(col, true);
+ foreach (var col in _table.Columns.Values)
+ if (cols.ContainsKey(col.Attribute.Name) == true || cols.ContainsKey(col.CsName) == true)
+ _ignore.Add(col.Attribute.Name, true);
return this;
}
public IUpdate UpdateColumns(string[] columns)
@@ -396,7 +385,7 @@ namespace FreeSql.Internal.CommonProvider
var cols = columns.ToDictionary(a => a);
_ignore.Clear();
foreach (var col in _table.Columns.Values)
- if (cols.ContainsKey(col.Attribute.Name) == false)
+ if (cols.ContainsKey(col.Attribute.Name) == false && cols.ContainsKey(col.CsName) == false)
_ignore.Add(col.Attribute.Name, true);
return this;
}