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

"Navigating and including nullable relationships" example #4351

Closed
uecasm opened this issue May 22, 2023 · 1 comment · Fixed by #4352
Closed

"Navigating and including nullable relationships" example #4351

uecasm opened this issue May 22, 2023 · 1 comment · Fixed by #4352
Milestone

Comments

@uecasm
Copy link

uecasm commented May 22, 2023

Console.WriteLine(order.OptionalInfo!.ExtraAdditionalInfo!.SomeExtraAdditionalInfo);

This example is cited in a section that talks about nullable navigations not needing explicit null checks in the context of LINQ to EF queries, because the null checks are implied by the query rewrite. But the above code is not in that context, and it seems entirely reasonable for any of those optional properties to actually be null (and thus inappropriate to use the ! operator), absent some additional context (such as order being the result of a query that did already verify all those properties).


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

roji added a commit to roji/EntityFramework.Docs that referenced this issue May 22, 2023
@roji
Copy link
Member

roji commented May 22, 2023

Thanks, makes sense - I've changed the sample to show an explicit query to make this clear.

@roji roji added this to the 8.0.0 milestone May 22, 2023
roji added a commit that referenced this issue May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants