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 ThrowHelper.Filtering_CouldNotParseValue(this, value, field.Type, field);
    }
 protected override Expression HandleListOperation(
     QueryableFilterContext context,
     IFilterField field,
     ObjectFieldNode node,
     Type closureType,
     LambdaExpression lambda) =>
 FilterExpressionBuilder.Not(
     FilterExpressionBuilder.Any(closureType, context.GetInstance(), lambda));
    public override Expression HandleOperation(
        QueryableFilterContext context,
        IFilterOperationField field,
        IValueNode value,
        object parsedValue)
    {
        Expression property = context.GetInstance();

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

        return(FilterExpressionBuilder.Not(
                   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 ThrowHelper.Filtering_CouldNotParseValue(this, value, field.Type, field);
        }

        return(FilterExpressionBuilder.Not(
                   FilterExpressionBuilder.LowerThanOrEqual(property, parsedValue)));
    }
        public override bool TryHandleLeave(
            QueryableFilterContext context,
            IFilterField field,
            ObjectFieldNode node,
            [NotNullWhen(true)] out ISyntaxVisitorAction?action)
        {
            // Dequeue last
            Expression instance = context.PopInstance();

            context.RuntimeTypes.Pop();
            Expression condition = IsTrue ? instance : FilterExpressionBuilder.Not(instance);

            if (context.InMemory)
            {
                condition = FilterExpressionBuilder.NotNullAndAlso(
                    context.GetInstance(),
                    condition);
            }

            context.GetLevel().Enqueue(condition);
            action = SyntaxVisitor.Continue;
            return(true);
        }