示例#1
0
            public async Task <IEnumerable <Attendee> > GetAttendeesAsync(Session session,
                                                                          [ScopedService] ApplicationDbContext dbContext, AttendeeByIdDataLoader attendeeByIdDataLoader,
                                                                          CancellationToken cancellationToken)
            {
                var speakerIds = 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 attendeeByIdDataLoader.LoadAsync(speakerIds, cancellationToken));
            }
示例#2
0
        public async Task <IEnumerable <Attendee> > GetAttendeesAsync(
            [Parent] Session session,
            [ScopedService] ApplicationDbContext dbContext,
            AttendeeByIdDataLoader attendeeById,
            CancellationToken cancellationToken)
        {
            int[] attendeeIds = await dbContext.Sessions
                                .Where(s => s.Id == session.Id)
                                .Include(s => s.SessionAttendees)
                                .SelectMany(s => s.SessionAttendees.Select(t => t.AttendeeId))
                                .ToArrayAsync(cancellationToken);

            return(await attendeeById.LoadAsync(attendeeIds, cancellationToken));
        }
示例#3
0
 public Task <Attendee> GetAttendeeAsync(
     AttendeeByIdDataLoader attendeeById,
     CancellationToken cancellationToken) =>
 attendeeById.LoadAsync(AttendeeId, cancellationToken);
示例#4
0
 public async Task <IEnumerable <Attendee> > GetAttendeeByIdAsync(
     [ID(nameof(Attendee))] int[] ids,
     AttendeeByIdDataLoader attendeeById,
     CancellationToken cancellationToken) =>
 await attendeeById.LoadAsync(ids, cancellationToken);
示例#5
0
 public Task <Attendee> GetAttendeeByIdAsync(
     [ID(nameof(Attendee))] int id,
     AttendeeByIdDataLoader attendeeById,
     CancellationToken cancellationToken) =>
 attendeeById.LoadAsync(id, cancellationToken);