From 6147081e5589d71edc3ccd8f3b633941c3c5024c Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Tue, 27 Dec 2022 13:10:34 +0800 Subject: [PATCH] Add Expressionable T0-T12 --- .../ExpressionableProvider/Expressionable.cs | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/Src/Asp.Net/SqlSugar/Abstract/ExpressionableProvider/Expressionable.cs b/Src/Asp.Net/SqlSugar/Abstract/ExpressionableProvider/Expressionable.cs index 36d20c2a8..8817dbd00 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/ExpressionableProvider/Expressionable.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/ExpressionableProvider/Expressionable.cs @@ -491,6 +491,50 @@ namespace SqlSugar return _exp; } } + 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() where T7 : class, new() where T8 : class, new() where T9 : 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, t7, t8, t9, t10, t11,t12) => true; + return _exp; + } + } public class Expressionable { public static Expressionable Create() where T : class, new()