Stop generating includes in nav expansion for primitive collection properties#34047
Merged
roji merged 1 commit intodotnet:mainfrom Jun 21, 2024
Merged
Stop generating includes in nav expansion for primitive collection properties#34047roji merged 1 commit intodotnet:mainfrom
roji merged 1 commit intodotnet:mainfrom
Conversation
roji
commented
Jun 21, 2024
|
|
||
| if (!(includeExpression.Navigation is INavigation includableNavigation | ||
| && includableNavigation.IsEmbedded())) | ||
| if (includeExpression.Navigation is not INavigation includableNavigation || !includableNavigation.IsEmbedded()) |
|
|
||
| case MaterializeCollectionNavigationExpression: | ||
| case IncludeExpression: | ||
| case PrimitiveCollectionReference: |
|
|
||
| public override async Task Array_of_byte() | ||
| { | ||
| // TODO |
Member
Author
There was a problem hiding this comment.
This PR introduces the non-shared primitive collection tests for Cosmos - there are 3 failures. I've made a note and will investigate.
ajcvickers
reviewed
Jun 21, 2024
| case MaterializeCollectionNavigationExpression: | ||
| case IncludeExpression: | ||
| case PrimitiveCollectionReference: | ||
| return extensionExpression; |
ajcvickers
approved these changes
Jun 21, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The original implementation of primitive collections in 8.0 contained a bug, where nav expansion would generate IncludeExpressions for owned entity types of X when a primitive collection was accessed on X. So e.g.
context.Blogs.Select(b => b.Ints)would get rewritten tocontext.Blogs.Select(b => [IncludeExpression].Ints). Nav expansion does not do this rewriting for regular property accesses, and so shouldn't do it for primitive collection properties either.This incorrect IncludeExpression was the root cause of #34008 in Cosmos. In relational, owned entities are handled in a special way during translation (ExpandSharedTypeEntities), and this IncludeExpression did not interfere - but it's still incorrect.
Fixes #34008
/cc @maumar