Closed robcecil closed 1 month ago
`private class SpeakerResolvers
{
public async Task<IEnumerable<Session>> GetSessionAsync(
[Parent]Speaker speaker,
[ScopedService]ApplicationDbContext dbContext,
SessionByIdDataLoader sessionByIdDataLoader,
CancellationToken cancellationToken
)
{
int[] sessionIds = await dbContext.Speakers
.Where(s => s.Id == speaker.Id)
.Include(s => s.SessionSpeakers)
.SelectMany(s => s.SessionSpeakers.Select(t => t.SessionId))
.ToArrayAsync(cancellationToken);
return await sessionByIdDataLoader.LoadAsync(sessionIds, cancellationToken);
}
}`
marking the first parameter with the Parent attribute solved it for me. specified in v11 to v12 the upgrade guide https://chillicream.com/docs/hotchocolate/api-reference/migrate-from-11-to-12#resolvers
Should be mentioned in the workshop I think. Had the same problem today and took me some time to figure it out. I see that other people also encountered this issue.
Thanks for posting this, wasted a little bit of time on it.
I'm closing this issue as outdated, as we have an updated workshop on the main
branch, for Hot Chocolate 14.
When completing section 3 "Understanding Dataloaders", with the introduction of SpeakerType, and SpeakerResolvers, I'm getting the error: