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)); }
public async Task <Order> GetOrderAsync(int id, OrderByIdDataLoader dataLoader, CancellationToken cancellationToken) => await dataLoader.LoadAsync(id, cancellationToken);