public async Task <IEnumerable <Product> > GetProductAsync( OrderItem OrderItem, [ScopedService] ApplicationDbContext dbContext, ProductByIdDataLoader productById, CancellationToken cancellationToken) { int[] Ids = await dbContext.Products .Where(p => p.Id == OrderItem.ProductId) .Select(col => col.Id) .ToArrayAsync(); return(await productById.LoadAsync(Ids, cancellationToken)); }
public Task <Product> GetProductAsync( int id, ProductByIdDataLoader dataLoader, CancellationToken cancellationToken) => dataLoader.LoadAsync(id, cancellationToken);
public Task <Product> OnProductCreatedAsync( [EventMessage] int productId, ProductByIdDataLoader productById, CancellationToken cancellationToken) => productById.LoadAsync(productId, cancellationToken);
public Task <Product> GetProductAsync( [ID(nameof(Product))] Guid id, ProductByIdDataLoader dataLoader, CancellationToken cancellationToken) => dataLoader.LoadAsync(id, cancellationToken);