public SeatQueryType(CineOrgContext context) { Field(theatre => theatre.Id); Field("rowletter", theatre => theatre.RowLetter.ToString()); Field(theatre => theatre.SeatNumber); Field <StringGraphType>( "category", resolve: ctx => context.Seats.Single(mov => mov.Id == ctx.Source.Id).Category.Key); }
public MovieQueryType(CineOrgContext context) { Field(movie => movie.Id); Field(movie => movie.Title); Field(movie => movie.Description); Field(movie => movie.YearReleased); Field <StringGraphType>( "genre", resolve: ctx => context.Movies.Single(mov => mov.Id == ctx.Source.Id).Genre.Key); }
public TheatreQueryType(CineOrgContext context, IDataLoaderContextAccessor dataLoaderContextAccessor) { _context = context; Field(theatre => theatre.Id); Field(theatre => theatre.Name); Field <ListGraphType <SeatQueryType> >( "seats", resolve: ctx => { // return context.Seats.Where(seat => seat.TheatreId == ctx.Source.Id).ToListAsync(); var loader = dataLoaderContextAccessor .Context .GetOrAddCollectionBatchLoader <Guid, DomainSeat>( "GetDomainSeatsByTheatreId", GetDomainSeatsByTheatreId); return(loader.LoadAsync(ctx.Source.Id)); }); }
public DeleteMovieCommandHandler(CineOrgContext context, ILogger <DeleteMovieCommandHandler> logger) { _context = context ?? throw new ArgumentNullException(nameof(context)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }