/// <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="subCondition">Sub-condition to be added to the SearchCondition. /// <b>Null</b> and empty search conditions are not allowed.</param> public void Or(SearchCondition subCondition) { if (subCondition == null || subCondition.IsEmpty) throw new ArgumentNullException("subCondition", Messages.SearchCondition_SubConditionMayNotBeNull); if (!this.IsEmpty) this.predicateExpression.Add(ConditionOperator.Or); this.predicateExpression.Add(subCondition); }
/// <summary> /// Indicates whether the specified search condition is empty or a <n>null</n> reference. /// </summary> /// <param name="value">A <see cref="SearchCondition"/> reference.</param> /// <returns><b>true</b> if the value parameter is empty or a <n>null</n> reference; otherwise, <b>false</b>.</returns> public static bool IsNullOrEmpty(SearchCondition value) { bool isNullOrEmpty = (value == null) || (value.IsEmpty); return isNullOrEmpty; }
/// <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(SearchCondition)"/>. /// </summary> /// <param name="subCondition">Sub-condition to be added to the SearchCondition. /// <b>Null</b> and empty search conditions are not allowed.</param> public void Add(SearchCondition subCondition) { And(subCondition); }