public async Task <Session?> GetSessionAsync(
            SessionByIdDataLoader sessionById,
            CancellationToken cancellationToken)
        {
            if (_sessionId.HasValue)
            {
                return(await sessionById.LoadAsync(_sessionId.Value, cancellationToken));
            }

            return(null);
        }
Beispiel #2
0
        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));
        }
Beispiel #3
0
            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));
        }
Beispiel #5
0
 public Task <Session> GetAttendeeAsync(
     SessionByIdDataLoader sessionById,
     CancellationToken cancellationToken) =>
 sessionById.LoadAsync(AttendeeId, cancellationToken);
Beispiel #6
0
 public Task <Session> OnSessionScheduledAsync(
     [EventMessage] int sessionId,
     SessionByIdDataLoader sessionById,
     CancellationToken cancellationToken) =>
 sessionById.LoadAsync(sessionId, cancellationToken);
Beispiel #7
0
 public async Task <IEnumerable <Session> > GetSessionsByIdAsync(
     [ID(nameof(Session))] int[] ids,
     SessionByIdDataLoader sessionById,
     CancellationToken cancellationToken) =>
 await sessionById.LoadAsync(ids, cancellationToken);
Beispiel #8
0
 public Task <Session> GetSessionByIdAsync(
     [ID(nameof(Session))] int id,
     SessionByIdDataLoader sessionById,
     CancellationToken cancellationToken) =>
 sessionById.LoadAsync(id, cancellationToken);
Beispiel #9
0
 public SessionAttendeeCheckIn OnAttendeeCheckedIn(
     [ID(nameof(Session))] int sessionId,
     [EventMessage] int attendeeId,
     SessionByIdDataLoader sessionById,
     CancellationToken cancellationToken) =>
 new SessionAttendeeCheckIn(attendeeId, sessionId);
Beispiel #10
0
 public Task <Session> GetSessionAsync(
     SessionByIdDataLoader sessionById,
     int id,
     CancellationToken cancellationToken) =>
 sessionById.LoadAsync(id, cancellationToken);