mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-18 17:48:11 +08:00
Add Expressionable<T, T2, T3, T4,T5>
This commit is contained in:
@@ -182,6 +182,50 @@ namespace SqlSugar
|
||||
return _exp;
|
||||
}
|
||||
}
|
||||
public class Expressionable<T, T2, T3, T4,T5> where T : class, new() where T2 : class, new() where T3 : class, new() where T4 : class, new() where T5: class,new()
|
||||
{
|
||||
Expression<Func<T, T2, T3, T4,T5, bool>> _exp = null;
|
||||
|
||||
public Expressionable<T, T2, T3, T4,T5> And(Expression<Func<T, T2, T3, T4,T5, bool>> exp)
|
||||
{
|
||||
if (_exp == null)
|
||||
_exp = exp;
|
||||
else
|
||||
_exp = Expression.Lambda<Func<T, T2, T3, T4,T5, bool>>(Expression.AndAlso(_exp.Body, exp.Body), _exp.Parameters);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Expressionable<T, T2, T3, T4,T5> AndIF(bool isAnd, Expression<Func<T, T2, T3, T4,T5, bool>> exp)
|
||||
{
|
||||
if (isAnd)
|
||||
And(exp);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Expressionable<T, T2, T3, T4,T5> Or(Expression<Func<T, T2, T3, T4,T5, bool>> exp)
|
||||
{
|
||||
if (_exp == null)
|
||||
_exp = exp;
|
||||
else
|
||||
_exp = Expression.Lambda<Func<T, T2, T3, T4,T5, bool>>(Expression.OrElse(_exp.Body, exp.Body), _exp.Parameters);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Expressionable<T, T2, T3, T4,T5> OrIF(bool isOr, Expression<Func<T, T2, T3, T4,T5, bool>> exp)
|
||||
{
|
||||
if (isOr)
|
||||
Or(exp);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Expression<Func<T, T2, T3, T4,T5, bool>> ToExpression()
|
||||
{
|
||||
if (_exp == null)
|
||||
_exp = (it, t2, t3, t4,T5) => true;
|
||||
return _exp;
|
||||
}
|
||||
}
|
||||
|
||||
public class Expressionable
|
||||
{
|
||||
@@ -201,5 +245,9 @@ namespace SqlSugar
|
||||
{
|
||||
return new Expressionable<T, T2, T3,T4>();
|
||||
}
|
||||
public static Expressionable<T, T2, T3, T4,T5> Create<T, T2, T3, T4,T5>() where T : class, new() where T2 : class, new() where T3 : class, new() where T4 : class, new() where T5:class,new()
|
||||
{
|
||||
return new Expressionable<T, T2, T3, T4,T5>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user