private static async Task <IDictionary <string, ExpCategory> > LoadCategoriesAsync(IMediator mediator, IEnumerable <string> ids, IResolveFieldContext context) { var loadCategoryQuery = context.GetCatalogQuery <LoadCategoryQuery>(); loadCategoryQuery.ObjectIds = ids.Where(x => x != null).ToArray(); loadCategoryQuery.IncludeFields = context.SubFields.Values.GetAllNodesPaths(); var response = await mediator.Send(loadCategoryQuery); return(response.Categories.ToDictionary(x => x.Id)); }
private static async Task <IDictionary <string, ExpProduct> > LoadProductsAsync(IMediator mediator, IEnumerable <string> ids, IResolveFieldContext context) { var query = context.GetCatalogQuery <LoadProductsQuery>(); query.ObjectIds = ids.ToArray(); query.IncludeFields = context.SubFields.Values.GetAllNodesPaths().ToArray(); var response = await mediator.Send(query); return(response.Products.ToDictionary(x => x.Id)); }