public async Task <IDictionary <int, PageSummary> > ExecuteAsync(GetPageSummariesByIdRangeQuery query, IExecutionContext executionContext) { var dbResult = await QueryPages(query, executionContext); var mappedResult = await _pageSummaryMapper.MapAsync(dbResult, executionContext); var dictionary = mappedResult.ToDictionary(d => d.PageId); return(dictionary); }
public async Task <PagedQueryResult <PageSummary> > ExecuteAsync(SearchPageSummariesQuery query, IExecutionContext executionContext) { var dbPagedResult = await CreateQuery(query, executionContext) .ToPagedResultAsync(query); // Finish mapping children var mappedResults = await _pageSummaryMapper.MapAsync(dbPagedResult.Items, executionContext); return(dbPagedResult.ChangeType(mappedResults)); }
public async Task <IDictionary <int, PageSummary> > ExecuteAsync(GetPageSummariesByIdRangeQuery query, IExecutionContext executionContext) { var dbResult = await CreateQuery(query).ToListAsync(); // Finish mapping children var mappedResult = await _pageSummaryMapper.MapAsync(dbResult, executionContext); var dictionary = mappedResult.ToDictionary(d => d.PageId); return(dictionary); }
public async Task <PagedQueryResult <PageSummary> > ExecuteAsync(SearchPageSummariesQuery query, IExecutionContext executionContext) { var dbPagedResult = await CreateQuery(query, executionContext) .ToPagedResultAsync(query); // Have to refilter here because EF won't let us include related entieis after a .Select statement yet var items = dbPagedResult .Items .Select(p => p.Page) .ToList(); // Finish mapping children var mappedResults = await _pageSummaryMapper.MapAsync(items, executionContext); return(dbPagedResult.ChangeType(mappedResults)); }