public bool Enter( FilterOperationField field, ObjectFieldNode node, IQueryableFilterVisitorContext context, out ISyntaxVisitorAction action) { if (field.Operation.Kind == FilterOperationKind.ArraySome || field.Operation.Kind == FilterOperationKind.ArrayNone || field.Operation.Kind == FilterOperationKind.ArrayAll) { MemberExpression nestedProperty = Expression.Property( context.GetInstance(), field.Operation.Property); context.PushInstance(nestedProperty); Type closureType = GetTypeFor(field.Operation); context.AddClosure(closureType); action = SyntaxVisitor.Continue; return(true); } action = SyntaxVisitor.Skip; return(false); }
public static QueryableClosure AddIsNullClosure( this IQueryableFilterVisitorContext context, Type type) { QueryableClosure closure = context.AddClosure(type, "_s" + context.Closures.Count, false); context.GetLevel().Enqueue(FilterExpressionBuilder.Equals(closure.Parameter, null)); return(closure); }
public static bool Enter( FilterOperationField field, ObjectFieldNode node, IQueryableFilterVisitorContext context, [NotNullWhen(true)] out ISyntaxVisitorAction?action) { if (field.Operation.Kind == FilterOperationKind.ArraySome || field.Operation.Kind == FilterOperationKind.ArrayNone || field.Operation.Kind == FilterOperationKind.ArrayAll) { if (!field.Operation.IsNullable && node.Value.IsNull()) { context.ReportError( ErrorHelper.CreateNonNullError(field, node, context)); action = SyntaxVisitor.Skip; return(true); } MemberExpression nestedProperty = Expression.Property( context.GetInstance(), field.Operation.Property); context.PushInstance(nestedProperty); Type closureType = GetTypeFor(field.Operation); if (node.Value.IsNull()) { context.AddIsNullClosure(closureType); action = SyntaxVisitor.SkipAndLeave; } else { context.AddClosure(closureType); action = SyntaxVisitor.Continue; } return(true); } action = null; return(false); }
public static QueryableClosure AddClosure( this IQueryableFilterVisitorContext context, Type type) => context.AddClosure(type, "_s" + context.Closures.Count, context.InMemory);