public async Task <IEnumerable <Orders> > GetOrdersAsync(
                Customers customer,
                [ScopedService] ApplicationDbContext dbContext,
                OrderByIdDataLoader orderById,
                CancellationToken cancellationToken)
            {
                int[] orderIds = await dbContext.Customers
                                 .Where(s => s.Id == customer.Id)
                                 .Include(s => s.Orders)
                                 .SelectMany(s => s.Orders.Select(t => t.Id))
                                 .ToArrayAsync();

                return(await orderById.LoadAsync(orderIds, cancellationToken));
            }
Exemple #2
0
 public async Task <Order> GetOrderAsync(int id, OrderByIdDataLoader dataLoader, CancellationToken cancellationToken) =>
 await dataLoader.LoadAsync(id, cancellationToken);