protected override async Task <IReadOnlyDictionary <int, SecondClass> > LoadBatchAsync(IReadOnlyList <int> keys, CancellationToken cancellationToken) { await using SecondDbContext dbContext = _dbContextFactory.CreateDbContext(); return(await dbContext.Seconds .Where(s => keys.Contains(s.Id)) .ToDictionaryAsync(t => t.Id, cancellationToken)); }
public IQueryable <SecondClass> GetSeconds([ScopedService] SecondDbContext context) => context.Seconds;