Hi, question, for data loaders if you use projection does the GQL selects all the fields from the database, or when you use DataLoaders projections does not work?
@@SingletonSean Thanks for the reply Sean! I tried doing this with a one to many relation, but noticed that the resolver will still be called several number of times even though the call to database will only be once. I tried this in a normal scenario as well as in the case of schema stitching.
@@aivalo I came across this now, about a year later. As far as I can tell the way to go is to use a GroupedDataLoader instead of a BatchDataLoader. I am using those in my project and it works like a charm. Technically, you can also groupBy and return a List instead of single objects, but the GroupedDataLoader takes most of it off your hand. Its nothing more than: DbContext..Where(e => keys.Contains(e.refId)).ToLookup(e => e.RefId); You can also squeeze in a mapping using .Select(MappingExpression) in between.
Man, you've just saved my day! I finally got this to work, which I couldn't after reading all of official documentation >_
great video & tutorial!! small note for 2024: the [Service] attribute isn't necessary and in fact will break the batch loading functionality 😊
Thank you!
Hi Sean, excellent content. I was wondering if you could explain in future videos how to implement one to many relationships with HotChocolate.
Hi Sean.
Excellent tutorials.
Could you please tell how to setup mock data for InstructorType with Bogus in case if we use InstructorDataLoader ?
Hi, question, for data loaders if you use projection does the GQL selects all the fields from the database, or when you use DataLoaders projections does not work?
Hey, really nice video, but could u please do this for one to many relations? Please, thanks a lot.
Hey Naman, I'll make sure to do a one to many before the end of this series!
@@SingletonSean Thanks for the reply Sean! I tried doing this with a one to many relation, but noticed that the resolver will still be called several number of times even though the call to database will only be once. I tried this in a normal scenario as well as in the case of schema stitching.
@@SingletonSean any news from this?
And a really nice video man!
@@aivalo I came across this now, about a year later. As far as I can tell the way to go is to use a GroupedDataLoader instead of a BatchDataLoader. I am using those in my project and it works like a charm.
Technically, you can also groupBy and return a List instead of single objects, but the GroupedDataLoader takes most of it off your hand. Its nothing more than:
DbContext..Where(e => keys.Contains(e.refId)).ToLookup(e => e.RefId);
You can also squeeze in a mapping using .Select(MappingExpression) in between.