Skip to content
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

Avoid checking for null on non-nullable property for projection #6706

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

glen-84
Copy link
Collaborator

@glen-84 glen-84 commented Nov 17, 2023

Summary of the changes (Less than 80 chars)

  • Check the nullability of properties before doing a null check.

Closes #6604.


  • I'm not sure what context.InMemory is about.
  • Is there an existing utility function/extension method for checking this nullability?
  • Should these nullability checks be cached?

@glen-84
Copy link
Collaborator Author

glen-84 commented Dec 6, 2023

@PascalSenn Is this feasible?

@PascalSenn
Copy link
Member

@glen-84

We did remove it once for ef core and then added it again:
#6604 (comment)

So i am not sure what to do now. I believe if you do not do the nullcheck then it will include all the fields from the child or something like this.

@glen-84
Copy link
Collaborator Author

glen-84 commented Dec 6, 2023

You removed it completely, or conditionally based on the nullability of the property?

Should I be seeing something significant in the test snapshots, or is there no test that would highlight the previous issue? If not, then I think that we need that test to exist in order to have some more confidence here.

@PascalSenn
Copy link
Member

This is the context:
28ed6ae

So you only apply it when the property is nullable and ef does not complain?

@glen-84
Copy link
Collaborator Author

glen-84 commented Dec 6, 2023

So you only apply it when the property is nullable and ef does not complain?

By "does not complain", you mean that the tests in HotChocolate.Data.Projections.SqlServer.Tests pass? If so, yes, they all pass.

@glen-84
Copy link
Collaborator Author

glen-84 commented Feb 4, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants