Browse Source

Add UpdateSetColumnsTrue

SqlSugar5
sunkaixuan 2 years ago
parent
commit
6b760270ae
  1. 2
      Src/Asp.Net/SqlSugar/Interface/ISimpleClient.cs
  2. 8
      Src/Asp.Net/SqlSugar/SimpleClient.cs

2
Src/Asp.Net/SqlSugar/Interface/ISimpleClient.cs

@ -49,6 +49,7 @@ namespace SqlSugar
bool IsAny(Expression<Func<T, bool>> whereExpression);
bool Update(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression);
bool UpdateSetColumnsTrue(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression);
bool Update(T updateObj);
bool UpdateRange(List<T> updateObjs);
bool UpdateRange(T[] updateObjs);
@ -83,6 +84,7 @@ namespace SqlSugar
Task<T> InsertReturnEntityAsync(T insertObj);
Task<bool> IsAnyAsync(Expression<Func<T, bool>> whereExpression);
Task<bool> UpdateSetColumnsTrueAsync(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression);
Task<bool> UpdateAsync(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression);
Task<bool> UpdateAsync(T updateObj);
Task<bool> UpdateRangeAsync(List<T> updateObjs);

8
Src/Asp.Net/SqlSugar/SimpleClient.cs

@ -212,6 +212,10 @@ namespace SqlSugar
{
return this.Context.Updateable<T>().SetColumns(columns).Where(whereExpression).ExecuteCommand() > 0;
}
public virtual bool UpdateSetColumnsTrue(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression)
{
return this.Context.Updateable<T>().SetColumns(columns,true).Where(whereExpression).ExecuteCommand() > 0;
}
public virtual bool Delete(T deleteObj)
{
return this.Context.Deleteable<T>().Where(deleteObj).ExecuteCommand() > 0;
@ -342,6 +346,10 @@ namespace SqlSugar
{
return await this.Context.Updateable<T>().SetColumns(columns).Where(whereExpression).ExecuteCommandAsync() > 0;
}
public virtual async Task<bool> UpdateSetColumnsTrueAsync(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression)
{
return await this.Context.Updateable<T>().SetColumns(columns,true).Where(whereExpression).ExecuteCommandAsync() > 0;
}
public virtual async Task<bool> DeleteAsync(T deleteObj)
{
return await this.Context.Deleteable<T>().Where(deleteObj).ExecuteCommandAsync() > 0;

Loading…
Cancel
Save