I am trying to project my EF Core queries with Automapper to allow an 3rd layer in my application but I have some trouble allowing HotChocolate to request fields on my DTO and telling Automapper to include those fields in the projecting process.
Some important points beforehand:
- Automapper will request all NavigationProperties on a Map when both properties are present
- Except when the
ExplicitExpansion
setting is present - If
ExplicitExpansion
is set on a map, HotChocolate cannot expand the navigation properties of theIQueryable
with the use of[UseProjection]
So I could ether load all navigation properties at once or none.
How can I tell ether HotChocolate to map the entities in my IQueryable
, or how can I get the required keys in my query function to tell AutoMapper which properties to expand by using the IQueryable<T>.ProjectTo()
method?