[5.0.3] InMemory: Wrap composite key selector for owned type in AnonymousObject #23732
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.
Resolves #23687
Composite key selector needs wrapper so that we compare them component-wise
Description
When generating server side join for InMemory, we need to use Join from enumerable which takes key selectors for outer/inner. For composite key we generate an array of object where each index contain the property value. In order to compare them correctly during key selector we need to wrap them in AnonymousObject so that we compare matching indexes in both arrays. When we removed Anonymous object from core, we removed automatic injection of it in key selector generation hence queries with composite keys for owned reference failed to compare correctly.
Customer Impact
Queries where owned reference has composite key to owner will fail to match during join causing incorrect results to be generated in InMemory provider.
How found
Customer reported on 5.0.1.
Test coverage
We have added test coverage in this PR.
Regression?
Yes, from 3.1
Risk
Low. Only affects the faulty code path. Also added quirk to revert to earlier behavior.