public ValueTask <System.Int64> LongCountAsync(QueryAdapterBase queryAdapter, IQueryable source, CancellationToken cancellation) { if (source is not IQueryable <T> typedQueryable) { typedQueryable = source.Cast <T>(); } return(queryAdapter.LongCountAsync(typedQueryable, cancellation)); }
public AsyncTypeAwaitable MaxAsync(QueryAdapterBase queryAdapter, IQueryable source, CancellationToken cancellation) { if (source is not IQueryable <T> typedQueryable) { typedQueryable = source.Cast <T>(); } var task = queryAdapter.MaxAsync(typedQueryable, cancellation); return(task.AsTypeAwaitable()); }
public AsyncQueryProvider(QueryAdapterBase queryAdapter, MethodProcessor methodProcessor) { if (queryAdapter is null) { throw new ArgumentNullException(nameof(queryAdapter)); } if (methodProcessor is null) { throw new ArgumentNullException(nameof(methodProcessor)); } QueryAdapter = queryAdapter; _methodProcessor = methodProcessor; }
public ValueTask <System.Int64> LongCountAsync(QueryAdapterBase queryAdapter, IQueryable source, Expression predicate, CancellationToken cancellation) { if (source is not IQueryable <T> typedQueryable) { typedQueryable = source.Cast <T>(); } if (predicate is UnaryExpression unaryExpression && unaryExpression.NodeType == ExpressionType.Quote) { predicate = unaryExpression.Operand; } // TODO: Can we convert the selector if it is not of the appropriate type? return(queryAdapter.LongCountAsync(typedQueryable, (Expression <Func <T, bool> >)predicate, cancellation)); }
public AsyncTypeAwaitable SingleOrDefaultAsync( QueryAdapterBase queryAdapter, IQueryable source, Expression predicate, CancellationToken cancellation) { if (source is not IQueryable <T> typedQueryable) { typedQueryable = source.Cast <T>(); } if (predicate is UnaryExpression unaryExpression && unaryExpression.NodeType == ExpressionType.Quote) { predicate = unaryExpression.Operand; } // TODO: Can we convert the selector if it is not of the appropriate type? var task = queryAdapter.SingleOrDefaultAsync(typedQueryable, (Expression <Func <T, bool> >)predicate, cancellation); return(task.AsTypeAwaitable()); }
public static AsyncQueryable <T> Create <T>(QueryAdapterBase queryAdapter, MethodProcessor methodProcessor) { return(new AsyncQueryable <T>(queryAdapter, methodProcessor)); }