public async Task <List <Location> > GetLocation([Service] MyDbContext dbContext, string code) => await dbContext.Locations .AsNoTracking() .Where(l => l.Code == code) .OrderBy(l => l.Name) .ToListAsync();
/// <summary> /// Return a list of all locations /// Notice the [Service]. It's an auto look-up from HotChocolate /// </summary> /// <param name="dbContext"></param> /// <returns></returns> public async Task <List <Location> > GetLocations([Service] MyDbContext dbContext) => await dbContext.Locations .AsNoTracking() .OrderBy(l => l.Name) .ToListAsync();