mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-03 12:18:00 +08:00
Delete.WhereIF Update.WhereIF
This commit is contained in:
parent
f43efe3925
commit
fe29238456
@ -234,6 +234,15 @@ namespace SqlSugar
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public IDeleteable<T> WhereIF(bool isWhere, Expression<Func<T, bool>> expression)
|
||||
{
|
||||
Check.ExceptionEasy(!StaticConfig.EnableAllWhereIF, "Need to program startup configuration StaticConfig. EnableAllWhereIF = true; Tip: This operation is very risky if there are no conditions it is easy to update the entire table", " 需要程序启动时配置StaticConfig.EnableAllWhereIF=true; 提示:该操作存在很大的风险如果没有条件很容易将整个表全部更新");
|
||||
if (isWhere)
|
||||
{
|
||||
return Where(expression);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public IDeleteable<T> Where(Expression<Func<T, bool>> expression)
|
||||
{
|
||||
var expResult = DeleteBuilder.GetExpressionValue(expression, ResolveExpressType.WhereSingle);
|
||||
|
@ -831,7 +831,15 @@ namespace SqlSugar
|
||||
SetColumns(columns);
|
||||
return this;
|
||||
}
|
||||
|
||||
public IUpdateable<T> WhereIF(bool isWhere, Expression<Func<T, bool>> expression)
|
||||
{
|
||||
Check.ExceptionEasy(!StaticConfig.EnableAllWhereIF, "Need to program startup configuration StaticConfig. EnableAllWhereIF = true; Tip: This operation is very risky if there are no conditions it is easy to update the entire table", " 需要程序启动时配置StaticConfig.EnableAllWhereIF=true; 提示:该操作存在很大的风险如果没有条件很容易将整个表全部更新");
|
||||
if (isWhere)
|
||||
{
|
||||
return Where(expression);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public IUpdateable<T> Where(Expression<Func<T, bool>> expression)
|
||||
{
|
||||
Check.Exception(UpdateObjectNotWhere()&&UpdateObjs.Length > 1, ErrorMessage.GetThrowMessage("update List no support where","集合更新不支持Where请使用WhereColumns"));
|
||||
|
@ -26,7 +26,7 @@ namespace SqlSugar
|
||||
public static Func<List<SplitTableInfo>> SplitTableGetTablesFunc;
|
||||
|
||||
public static bool Check_StringIdentity = true;
|
||||
|
||||
public static bool EnableAllWhereIF = false;
|
||||
public static Func<string,string> Check_FieldFunc;
|
||||
public static Type DynamicExpressionParserType;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ namespace SqlSugar
|
||||
IDeleteable<T> AsType(Type tableNameType);
|
||||
IDeleteable<T> With(string lockString);
|
||||
IDeleteable<T> Where(T deleteObj);
|
||||
IDeleteable<T> WhereIF(bool isWhere, Expression<Func<T, bool>> expression);
|
||||
IDeleteable<T> Where(Expression<Func<T, bool>> expression);
|
||||
IDeleteable<T> Where(List<T> deleteObjs);
|
||||
DeleteablePage<T> PageSize(int pageSize);
|
||||
|
@ -32,6 +32,7 @@ namespace SqlSugar
|
||||
|
||||
|
||||
IUpdateable<T> Where(Expression<Func<T, bool>> expression);
|
||||
IUpdateable<T> WhereIF(bool isWhere,Expression<Func<T, bool>> expression);
|
||||
IUpdateable<T> Where(string whereSql,object parameters=null);
|
||||
/// <summary>
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user