Example #1
0
        /// <summary>
        /// Begins a grouping of statements with the provided logic type.
        /// </summary>
        public void BeginGroup(LogicTypes logicType)
        {
            var newGroup = new FilterBuilderGroup <TModel>(logicType, currentGroup);

            currentGroup.Add(newGroup);
            currentGroup = newGroup;
        }
        /// <summary>
        /// Creates a new grouping of filter steps.
        /// </summary>
        /// <param name="logicType">Type of join logic to use.</param>
        /// <param name="parent">Parent of this group.</param>
        public FilterBuilderGroup(LogicTypes logicType, FilterBuilderGroup <TModel> parent)
        {
            if (logicType == LogicTypes.NOT)
            {
                throw new InvalidOperationException("Cannot group filters using 'not' logic.");
            }

            this.logicType = logicType;
            this.parent    = parent;
            this.steps     = new List <FilterBuilderStep <TModel> >();
        }
Example #3
0
 public FilterExpressionBuilder(LogicTypes logicType = LogicTypes.AND)
 {
     currentGroup = new FilterBuilderGroup <TModel>(logicType, null);
     parameter    = Expression.Parameter(modelType, "model");
 }
Example #4
0
 /// <summary>
 /// Ends the innermost grouping of statements.
 /// </summary>
 public void EndGroup()
 {
     currentGroup = currentGroup.Parent;
 }