コード例 #1
0
 public override void Visit(PredicateFilter filter) =>
 PredicateBuilder(filter)(filter.Property, filter.Value);
コード例 #2
0
        private Func <FilterProperty, FilterValue, FilterExpressionBuilder <T> > PredicateBuilder(PredicateFilter filter)
        {
            switch (filter.Value.Type)
            {
            case FilterValueType.Scalar:
                switch (filter.Predicate)
                {
                case PredicateOperatorString.Equal:
                    return(Equal);

                case PredicateOperatorString.GreaterThan:
                    return(GreaterThan);

                case PredicateOperatorString.GreaterThanOrEqual:
                    return(GreaterThanOrEqual);

                case PredicateOperatorString.LessThan:
                    return(LessThan);

                case PredicateOperatorString.LessThanOrEqual:
                    return(LessThanOrEqual);

                case PredicateOperatorString.NotEqual:
                    return(NotEqual);

                default:
                    throw new NotSupportedException($"Predicate operator not supported for scalar value: {filter.Predicate}.");
                }

            case FilterValueType.Vector:
                switch (filter.Predicate)
                {
                case PredicateOperatorString.Contains:
                    return(Any);

                case PredicateOperatorString.Equal:
                    return(All);

                default:
                    throw new NotSupportedException($"Predicate operator not supported for vector value: {filter.Predicate}.");
                }

            default:
                throw new NotSupportedException($"Filter value type not supported '{filter.Value.Type}'.");
            }
        }