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

[release/7.0] Fix to #29355 - FromSqlRaw throws Exception when querying all objects that contain a certain string property in a json array column #29366

Merged
merged 1 commit into from
Oct 18, 2022

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Oct 15, 2022

Problem was that were not creating navigation bindings for JSON entities in the SelectExpression ctor which takes TableExpressionBase as argument. This would cause error in SharedTypeEntityExpandingExpressionVisitor which depends on those bindings to be present for entities mapped to JSON.

Fix is to use the same logic we use in the "main" SelectExpression ctor.

Fixes #29355

Customer impact
All queries using FromSql on entities that contain owned types mapped to JSON fail with NRE. FromSql is not the mainline scenario for JSON, but it could be used to work-around limitations in our JSON query translation capabilities, which is important given that there are quite a few limitations for JSON in the EF7 release. This issue effectively prevents the customers from using the workaround to unblock their scenarios.

How found
Found by a customer testing EF7 bits.

Regression
No, this is in the new feature.

Testing
New testing added for the reported scenario and additional cases around it.

Risk
Low, only affects JSON scenarios using non-standard query (e.g. FromSql). Fix applies exactly the same logic we use in the general scenario, as it is necessary but was missing.

… that contain a certain string property in a json array column

Problem was that were not creating navigation bindings for JSON entities in the SelectExpression ctor which takes TableExpressionBase as argument. This would cause error in SharedTypeEntityExpandingExpressionVisitor which depends on those bindings to be present for entities mapped to JSON.

Fix is to use the same logic we use in the "main" SelectExpression ctor.

Fixes #29355
@ajcvickers
Copy link
Member

@smitpatel Can you do a code review on this today so that we can potentially get it into GA?

@mmitche mmitche merged commit be9e79d into release/7.0 Oct 18, 2022
@mmitche mmitche deleted the fix29355 branch October 18, 2022 15:27
roji pushed a commit to roji/efcore that referenced this pull request Oct 20, 2022
…bjects that contain a certain string property in a json array column (dotnet#29366)

Problem was that were not creating navigation bindings for JSON entities in the SelectExpression ctor which takes TableExpressionBase as argument. This would cause error in SharedTypeEntityExpandingExpressionVisitor which depends on those bindings to be present for entities mapped to JSON.

Fix is to use the same logic we use in the "main" SelectExpression ctor.

Fixes dotnet#29355
@ajcvickers ajcvickers removed this from the 7.0.0 milestone Jan 12, 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 this pull request may close these issues.

4 participants