public async Task <IEnumerable <Speaker>?> GetSpeakersAsync( [ScopedService] ApplicationDbContext dbContext, SpeakerByIdDataLoader speakerById, CancellationToken cancellationToken) { if (Session is null) { return(null); } int[] speakerIds = await dbContext.Sessions .Where(s => s.Id == Session.Id) .Include(s => s.SessionSpeakers) .SelectMany(s => s.SessionSpeakers.Select(t => t.SpeakerId)) .ToArrayAsync(); return(await speakerById.LoadAsync(speakerIds, cancellationToken)); }
public Task <Speaker> GetSpeakerAsync( [ID(nameof(Speaker))] int id, SpeakerByIdDataLoader dataLoader, CancellationToken cancellationToken) => dataLoader.LoadAsync(id, cancellationToken);
public async Task <IEnumerable <Speaker> > GetSpeakersByIdAsync( [ID(nameof(Speaker))] int[] ids, SpeakerByIdDataLoader dataLoader, CancellationToken cancellationToken) => await dataLoader.LoadAsync(ids, cancellationToken);
public async Task <IEnumerable <Speaker> > GetSpeakersAsync(Session session, [ScopedService] ApplicationDbContext dbContext, SpeakerByIdDataLoader speakerByIdDataLoader, CancellationToken cancellationToken) { var speakersIds = await dbContext.Sessions.Where(s => s.Id == session.Id) .Include(s => s.SessionSpeakers) .SelectMany(s => s.SessionSpeakers.Select(t => t.SpeakerId)) .ToArrayAsync(cancellationToken); return(await speakerByIdDataLoader.LoadAsync(speakersIds, cancellationToken)); }
public Task <Speaker> GetSpeakerAsync( SpeakerByIdDataLoader speakerById, int id, CancellationToken cancellationToken) => speakerById.LoadAsync(id, cancellationToken);
public Task <IReadOnlyList <Speaker> > GetSpeakersByIdAsync( [ID(nameof(Speaker))] long[] ids, SpeakerByIdDataLoader dataLoader, CancellationToken cancellationToken) => dataLoader.LoadAsync(ids, cancellationToken);
public Task <Speaker> GetSpeaker(Guid id, SpeakerByIdDataLoader dataLoader, CancellationToken cancellationToken) => dataLoader.LoadAsync(id, cancellationToken);