mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 07:22:57 +08:00
Update IgnoreColumns
This commit is contained in:
parent
f51081be32
commit
0562a1bf6b
@ -28,6 +28,7 @@ namespace SqlSugar
|
|||||||
public List<string> WhereValues { get; set; }
|
public List<string> WhereValues { get; set; }
|
||||||
public List<KeyValuePair<string, string>> SetValues { get; set; }
|
public List<KeyValuePair<string, string>> SetValues { get; set; }
|
||||||
public bool IsNoUpdateNull { get; set; }
|
public bool IsNoUpdateNull { get; set; }
|
||||||
|
public bool IsNoUpdateDefaultValue { get; set; }
|
||||||
public List<string> PrimaryKeys { get; set; }
|
public List<string> PrimaryKeys { get; set; }
|
||||||
public bool IsOffIdentity { get; set; }
|
public bool IsOffIdentity { get; set; }
|
||||||
|
|
||||||
@ -140,6 +141,10 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
DbColumnInfoList = DbColumnInfoList.Where(it => it.Value != null).ToList();
|
DbColumnInfoList = DbColumnInfoList.Where(it => it.Value != null).ToList();
|
||||||
}
|
}
|
||||||
|
if (IsNoUpdateDefaultValue)
|
||||||
|
{
|
||||||
|
DbColumnInfoList = DbColumnInfoList.Where(it => it.Value.ObjToString() !=UtilMethods.DefaultForType(it.GetType()).ObjToString()).ToList();
|
||||||
|
}
|
||||||
var groupList = DbColumnInfoList.GroupBy(it => it.TableId).ToList();
|
var groupList = DbColumnInfoList.GroupBy(it => it.TableId).ToList();
|
||||||
var isSingle = groupList.Count() == 1;
|
var isSingle = groupList.Count() == 1;
|
||||||
if (isSingle)
|
if (isSingle)
|
||||||
|
@ -122,12 +122,13 @@ namespace SqlSugar
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public IUpdateable<T> IgnoreColumns(bool ignoreAllNullColumns, bool isOffIdentity = false)
|
public IUpdateable<T> IgnoreColumns(bool ignoreAllNullColumns, bool isOffIdentity = false,bool ignoreAllDefaultValue = false)
|
||||||
{
|
{
|
||||||
UpdateBuilder.IsOffIdentity = isOffIdentity;
|
UpdateBuilder.IsOffIdentity = isOffIdentity;
|
||||||
if (this.UpdateBuilder.LambdaExpressions == null)
|
if (this.UpdateBuilder.LambdaExpressions == null)
|
||||||
this.UpdateBuilder.LambdaExpressions = InstanceFactory.GetLambdaExpressions(this.Context.CurrentConnectionConfig);
|
this.UpdateBuilder.LambdaExpressions = InstanceFactory.GetLambdaExpressions(this.Context.CurrentConnectionConfig);
|
||||||
this.UpdateBuilder.IsNoUpdateNull = ignoreAllNullColumns;
|
this.UpdateBuilder.IsNoUpdateNull = ignoreAllNullColumns;
|
||||||
|
this.UpdateBuilder.IsNoUpdateDefaultValue = ignoreAllDefaultValue;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public IUpdateable<T> IgnoreColumns(Expression<Func<T, object>> columns)
|
public IUpdateable<T> IgnoreColumns(Expression<Func<T, object>> columns)
|
||||||
|
@ -77,7 +77,7 @@ namespace SqlSugar
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
IUpdateable<T> IgnoreColumns(bool ignoreAllNullColumns, bool isOffIdentity = false);
|
IUpdateable<T> IgnoreColumns(bool ignoreAllNullColumns, bool isOffIdentity = false, bool ignoreAllDefaultValue = false);
|
||||||
IUpdateable<T> IgnoreColumns(Expression<Func<T, object>> columns);
|
IUpdateable<T> IgnoreColumns(Expression<Func<T, object>> columns);
|
||||||
IUpdateable<T> IgnoreColumns(params string[] columns);
|
IUpdateable<T> IgnoreColumns(params string[] columns);
|
||||||
|
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user