/// <summary> /// Adds a boolean condition to the SearchCondition with an "OR" operator. /// If the SearchCondition is empty the "OR" operator is not added. /// </summary> /// <param name="predicate">Predicate to be added to the SearchCondition. <b>Null</b> is not allowed.</param> public void Or(PredicateBase predicate) { if (predicate == null) throw new ArgumentNullException("predicate", Messages.SearchCondition_PredicateMayNotBeNull); if (!this.IsEmpty) this.predicateExpression.Add(ConditionOperator.Or); this.predicateExpression.Add(predicate); }
/// <summary> /// Initializes a new instance of the SearchCondition class. /// </summary> /// <param name="firstPredicate">First/initial predicate added to the search condition.</param> public SearchCondition(PredicateBase firstPredicate) { Add(firstPredicate); }
/// <summary> /// Adds a boolean condition to the SearchCondition. /// If the SearchCondition is not empty then the expression is added with an "AND" operator. /// Essentially, same as <see cref="And(PredicateBase)"/>. /// </summary> /// <param name="predicate">Predicate to be added to the SearchCondition. <b>Null</b> is not allowed.</param> public void Add(PredicateBase predicate) { And(predicate); }
/// <summary> /// Converts a predicate to a search condition. /// </summary> /// <param name="predicate">Predicate.</param> /// <returns>Search condition which contains the given predicate.</returns> public static SearchCondition ToSearchCondition(PredicateBase predicate) { return new SearchCondition(predicate); }