public override Expression HandleOperation(
            QueryableFilterContext context,
            IFilterOperationField field,
            IValueNode value,
            object parsedValue)
        {
            if (context.RuntimeTypes.Count > 0 &&
                context.RuntimeTypes.Peek().TypeArguments is { Count : > 0 } args&&
                parsedValue is bool parsedBool)
            {
                Expression?property = context.GetInstance();

                Expression expression;
                if (parsedBool)
                {
                    expression = FilterExpressionBuilder.Any(args[0].Source, property);
                }
                else
                {
                    expression = FilterExpressionBuilder.Not(
                        FilterExpressionBuilder.Any(args[0].Source, property));
                }

                if (context.InMemory)
                {
                    expression = FilterExpressionBuilder.NotNullAndAlso(property, expression);
                }

                return(expression);
            }
            throw new InvalidOperationException();
        }
Example #2
0
 protected override Expression HandleListOperation(
     QueryableFilterContext context,
     IFilterField field,
     ObjectFieldNode node,
     Type closureType,
     LambdaExpression lambda) =>
 FilterExpressionBuilder.All(closureType, context.GetInstance(), lambda);
Example #3
0
        public override Expression HandleOperation(
            QueryableFilterContext context,
            IFilterOperationField field,
            IValueNode value,
            object?parsedValue)
        {
            Expression property = context.GetInstance();

            return(FilterExpressionBuilder.Contains(property, parsedValue));
        }
        public override Expression HandleOperation(
            QueryableFilterContext context,
            IFilterOperationField field,
            IValueNode value,
            object?parsedValue)
        {
            Expression property = context.GetInstance();

            parsedValue = ParseValue(value, parsedValue, field.Type, context);
            return(FilterExpressionBuilder.NotEquals(property, parsedValue));
        }
        public override Expression HandleOperation(
            QueryableFilterContext context,
            IFilterOperationField field,
            IValueNode value,
            object parsedValue)
        {
            Expression property = context.GetInstance();

            return(FilterExpressionBuilder.In(
                       property,
                       context.RuntimeTypes.Peek().Source,
                       parsedValue));
        }
        public override Expression HandleOperation(
            QueryableFilterContext context,
            IFilterOperationField field,
            IValueNode value,
            object?parsedValue)
        {
            Expression property = context.GetInstance();

            parsedValue = ParseValue(value, parsedValue, field.Type, context);

            if (parsedValue is null)
            {
                throw new InvalidOperationException();
            }

            return(FilterExpressionBuilder.GreaterThan(property, parsedValue));
        }