/// <summary> /// 非空字符串和空格字符串 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="build"></param> /// <param name="str"></param> /// <param name="rigthExpression"></param> /// <returns></returns> public static PredicateBuilder <T> OrIfNotEmpty <T>(this PredicateBuilder <T> build, string str, Expression <Func <T, bool> > rigthExpression) where T : class { if (!string.IsNullOrWhiteSpace(str)) { build.expression = PredicateExtensions.Or(build.Expression, rigthExpression); } return(build); }
/// <summary> /// 非空对象 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="build"></param> /// <param name="obj"></param> /// <param name="rigthExpression"></param> /// <returns></returns> public static PredicateBuilder <T> OrIfNotNull <T>(this PredicateBuilder <T> build, object obj, Expression <Func <T, bool> > rigthExpression) where T : class { if (obj != null) { build.expression = PredicateExtensions.Or(build.Expression, rigthExpression); } return(build); }
/// <summary> /// 非空集合 not null and .Any() /// </summary> /// <typeparam name="T"></typeparam> /// <param name="build"></param> /// <param name="src"></param> /// <param name="rigthExpression"></param> /// <returns></returns> public static PredicateBuilder <T> OrIfNotEmpty <T>(this PredicateBuilder <T> build, IEnumerable src, Expression <Func <T, bool> > rigthExpression) where T : class { if (src != null && src.GetEnumerator().MoveNext()) { build.expression = PredicateExtensions.Or(build.Expression, rigthExpression); } return(build); }
public static PredicateBuilder <T> OrIf <T>(this PredicateBuilder <T> build, bool condition, Expression <Func <T, bool> > rigthExpression) where T : class { if (condition) { build.expression = PredicateExtensions.Or(build.Expression, rigthExpression); } return(build); }
public PredicateBuilder <T> Or(Expression <Func <T, bool> > rigthExpression) { this.expression = PredicateExtensions.Or(this.expression, rigthExpression); return(this); }