예제 #1
0
        /// <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);
        }
예제 #2
0
 /// <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);
 }
예제 #3
0
 /// <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);
 }
예제 #4
0
 /// <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);
 }