diff --git a/Src/Asp.Net/SqlSugar/Abstract/ExpressionableProvider/Expressionable.cs b/Src/Asp.Net/SqlSugar/Abstract/ExpressionableProvider/Expressionable.cs index caff94a66..b4f095875 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/ExpressionableProvider/Expressionable.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/ExpressionableProvider/Expressionable.cs @@ -227,6 +227,50 @@ namespace SqlSugar } } + public class Expressionable where T : class, new() where T2 : class, new() where T3 : class, new() where T4 : class, new() where T5 : class, new() where T6 : class, new() + { + Expression> _exp = null; + + public Expressionable And(Expression> exp) + { + if (_exp == null) + _exp = exp; + else + _exp = Expression.Lambda>(Expression.AndAlso(_exp.Body, exp.Body), _exp.Parameters); + return this; + } + + public Expressionable AndIF(bool isAnd, Expression> exp) + { + if (isAnd) + And(exp); + return this; + } + + public Expressionable Or(Expression> exp) + { + if (_exp == null) + _exp = exp; + else + _exp = Expression.Lambda>(Expression.OrElse(_exp.Body, exp.Body), _exp.Parameters); + return this; + } + + public Expressionable OrIF(bool isOr, Expression> exp) + { + if (isOr) + Or(exp); + return this; + } + + + public Expression> ToExpression() + { + if (_exp == null) + _exp = (it, t2, t3, t4, T5, t6) => true; + return _exp; + } + } public class Expressionable { public static Expressionable Create() where T : class, new() @@ -249,5 +293,9 @@ namespace SqlSugar { return new Expressionable(); } + public static Expressionable Create() where T : class, new() where T2 : class, new() where T3 : class, new() where T4 : class, new() where T5 : class, new() where T6 : class, new() + { + return new Expressionable(); + } } }