-
-
Notifications
You must be signed in to change notification settings - Fork 748
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
[UseSelection] fails on nullable relationship #1624
Comments
Hi @DorianGreen
I will look into this 👍 |
@PascalSenn , Thanks for the clarification. The issue is, that EF will issue a left join from Foo to Bar, resulting in |
I have found a workaround for this issue.
This is really a hack around how EF Core handles nested selections and not a HC specific issue. It would still be nice if the SelectionVisitor could insert a null check like the query I showed above, but it may not work with other IQueriable providers. You can close this issue if it is not something you'd want to tackle in HC. |
@PascalSenn I have ran into an issue with my workaround. |
@DorianGreen didn't have time to look into this properly the past few days. Will do this weekend 👍 I think this is a fix we can provide |
Fixed in V11 and V10 |
Describe the bug
[UseSelection] compiles a query to an anonymous type, which breaks nullable optional relationships in EF Core.
To Reproduce
Model:
Query:
Result:
Expected behavior
Problem
The query is compiled to the equivalent of:
Because the selection is anonymous, EF has no idea that Bar should be null, and the result violates the GraphQL schema.
Solution
EF allows for null checks in the selection, which should mitigate the issue
HC Version: 11.0.0-preview.118
EF Core: 3.1.3
The text was updated successfully, but these errors were encountered: