Skip to content

Unable to spread fragment on inheritance hierarchy added as a union or interface type when deferred to Entity Framework. #4318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
TeunKooijman opened this issue Oct 14, 2021 · 1 comment · Fixed by #4444
Labels
Area: Data Issue is related to filtering, sorting, pagination or projections 🌶️ hot chocolate

Comments

@TeunKooijman
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Given an inheritance hierarchy, added to the schema as either a union type or interface type, and resolvers that defer directly to an IQueryable in the form of a DbSet from Entity Framework, issueing a query that spreads a fragment on a specific concrete subtype in the hierarchy, yields an execution exception, unless a field on the base type is projected.

Steps to reproduce

Please see the reproduction repository at https://github.com/TeunKooijman/reproductions-hotchocolate

Relevant log output

No response

Additional Context?

Please see the README.md in the reproduction repository at https://github.com/TeunKooijman/reproductions-hotchocolate

Product

Hot Chocolate

Version

12.0.1

@tobias-tengler tobias-tengler added Area: Data Issue is related to filtering, sorting, pagination or projections 🌶️ hot chocolate labels Oct 14, 2021
@msawczyn
Copy link

Additional information: I ran through the repro listed above and noticed that, if you remove the [UseProjection] attribute, the problem doesn't surface. I surmise that this is because, without [UseProjection], HC allows Entity Framework to bring the full object into the context, with the correct type, rather than creating an anonymous type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Data Issue is related to filtering, sorting, pagination or projections 🌶️ hot chocolate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants