mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 20:38:16 +08:00
- 增加 IUpdate/IDelete WhereIf 方法 #466;
This commit is contained in:
@ -86,7 +86,12 @@ namespace FreeSql.Internal.CommonProvider
|
||||
}
|
||||
public abstract List<T1> ExecuteDeleted();
|
||||
|
||||
public IDelete<T1> Where(Expression<Func<T1, bool>> exp) => this.Where(_commonExpression.ExpressionWhereLambdaNoneForeignObject(null, _table, null, exp?.Body, null, _params));
|
||||
public IDelete<T1> Where(Expression<Func<T1, bool>> exp) => WhereIf(true, exp);
|
||||
public IDelete<T1> WhereIf(bool condition, Expression<Func<T1, bool>> exp)
|
||||
{
|
||||
if (condition == false || exp == null) return this;
|
||||
return this.Where(_commonExpression.ExpressionWhereLambdaNoneForeignObject(null, _table, null, exp?.Body, null, _params));
|
||||
}
|
||||
public IDelete<T1> Where(string sql, object parms = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(sql)) return this;
|
||||
|
@ -519,7 +519,12 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this;
|
||||
}
|
||||
|
||||
public IUpdate<T1> Where(Expression<Func<T1, bool>> expression) => this.Where(_commonExpression.ExpressionWhereLambdaNoneForeignObject(null, _table, null, expression?.Body, null, _params));
|
||||
public IUpdate<T1> Where(Expression<Func<T1, bool>> exp) => WhereIf(true, exp);
|
||||
public IUpdate<T1> WhereIf(bool condition, Expression<Func<T1, bool>> exp)
|
||||
{
|
||||
if (condition == false || exp == null) return this;
|
||||
return this.Where(_commonExpression.ExpressionWhereLambdaNoneForeignObject(null, _table, null, exp?.Body, null, _params));
|
||||
}
|
||||
public IUpdate<T1> Where(string sql, object parms = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(sql)) return this;
|
||||
|
Reference in New Issue
Block a user