public async Task <Session?> GetSessionAsync( SessionByIdDataLoader sessionById, CancellationToken cancellationToken) { if (_sessionId.HasValue) { return(await sessionById.LoadAsync(_sessionId.Value, cancellationToken)); } return(null); }
public async Task <IEnumerable <Session> > GetSessionsAsync( [Parent] Track track, [ScopedService] ApplicationDbContext dbContext, SessionByIdDataLoader sessionById, CancellationToken cancellationToken) { int[] sessionIds = await dbContext.Sessions .Where(s => s.Id == track.Id) .Select(s => s.Id) .ToArrayAsync(cancellationToken); return(await sessionById.LoadAsync(sessionIds, cancellationToken)); }
public async Task <IEnumerable <Session> > GetSessionsAsync( Speaker speaker, [ScopedService] ApplicationDbContext dbContext, SessionByIdDataLoader sessionById, CancellationToken cancellationToken) { int[] speakerIds = await dbContext.Speakers .Where(s => s.Id == speaker.Id) .Include(s => s.SessionSpeakers) .SelectMany(s => s.SessionSpeakers.Select(t => t.SessionId)) .ToArrayAsync(); return(await sessionById.LoadAsync(speakerIds, cancellationToken)); }
public async Task <IEnumerable <Session> > GetSessionsAsync( [Parent] Attendee attendee, [ScopedService] ApplicationDbContext dbContext, SessionByIdDataLoader sessionById, CancellationToken cancellationToken) { int[] speakerIds = await dbContext.Attendees .Where(a => a.Id == attendee.Id) .Include(a => a.SessionsAttendees) .SelectMany(a => a.SessionsAttendees.Select(t => t.SessionId)) .ToArrayAsync(cancellationToken); return(await sessionById.LoadAsync(speakerIds, cancellationToken)); }
public Task <Session> GetAttendeeAsync( SessionByIdDataLoader sessionById, CancellationToken cancellationToken) => sessionById.LoadAsync(AttendeeId, cancellationToken);
public Task <Session> OnSessionScheduledAsync( [EventMessage] int sessionId, SessionByIdDataLoader sessionById, CancellationToken cancellationToken) => sessionById.LoadAsync(sessionId, cancellationToken);
public async Task <IEnumerable <Session> > GetSessionsByIdAsync( [ID(nameof(Session))] int[] ids, SessionByIdDataLoader sessionById, CancellationToken cancellationToken) => await sessionById.LoadAsync(ids, cancellationToken);
public Task <Session> GetSessionByIdAsync( [ID(nameof(Session))] int id, SessionByIdDataLoader sessionById, CancellationToken cancellationToken) => sessionById.LoadAsync(id, cancellationToken);
public SessionAttendeeCheckIn OnAttendeeCheckedIn( [ID(nameof(Session))] int sessionId, [EventMessage] int attendeeId, SessionByIdDataLoader sessionById, CancellationToken cancellationToken) => new SessionAttendeeCheckIn(attendeeId, sessionId);
public Task <Session> GetSessionAsync( SessionByIdDataLoader sessionById, int id, CancellationToken cancellationToken) => sessionById.LoadAsync(id, cancellationToken);