Optimization constraint

This commit is contained in:
sunkaixuan 2024-05-14 11:38:37 +08:00
parent 910825781b
commit 006b336a7b
2 changed files with 8 additions and 2 deletions
Src/Asp.NetCore2/SqlSugar/Abstract
DeleteProvider
UpdateProvider

View File

@ -251,7 +251,10 @@ namespace SqlSugar
}
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 (DeleteBuilder.WhereInfos.Any() != true)
{
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);

View File

@ -898,7 +898,10 @@ namespace SqlSugar
}
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 (UpdateBuilder.WhereValues.Any() != true)
{
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);