public async Task <IQueryExecutionResult <T> > Read( [FromServices] AcmeContext context, [FromServices] IQueryHandlerAsync handler, [FromBody] IQueryCriteria criteria) { IQueryable <T> query = context.Set <T>(); var result = await handler.ExecuteAsync(query, criteria); return(result); }
public async Task <IQueryExecutionResult <T> > Get( [FromServices] AcmeContext context, [FromServices] IQueryHandlerAsync handler, [FromServices] IQueryCriteria criteria, int?page = null, int?pageSize = null) { criteria.Page = page; criteria.PageSize = pageSize; IQueryable <T> query = context.Set <T>(); var result = await handler.ExecuteAsync(query, criteria); return(result); }
protected async Task <IQueryExecutionResult <TDestination> > ProcessQueryAsync(IDynamicQuery query, CancellationToken cancellationToken = default) { var source = await GetQueryableAsync(query, cancellationToken); source = await AlterSourceAsync(source, query, cancellationToken); var options = GetQueryExecutionOptions(source, query); var interceptors = this.GetInterceptors(); foreach (var interceptor in interceptors) { queryHandlerAsync.AddInterceptor(interceptor); } var criteria = CreateCriteriaFromQuery(query); var result = await queryHandlerAsync.ExecuteAsync <TSource, TDestination>(source, criteria, options, cancellationToken); return(result); }