Skip to content

Conversation

@roji
Copy link
Member

@roji roji commented Nov 24, 2025

Closes #34627

Description

One of EF 10.0's main new features is full support for complex JSON. Unfortunately, we had an omission where the necessary modeling information is absent for raw SQL queries. While the full, proper fix is tracked as #34627 for 11, this PR proposes to temporarily work around the lack of modeling information, allowing the use of SQL queries on entities which have JSON complex types.

Customer impact

Entity types which have complex JSON types on them cannot currently be queried out with SQL queries (e.g. FromSql), which is an important and often-used mechanism where EF cannot translate from LINQ (or translates to sub-optimal SQL).

How found

Multiple customers reported on 10.0.0

Regression

No.

Testing

Added.

Risk

Very low, trivial targeted fix for a case that otherwise immediately throws an exception.


Original description

@AndriySvyryd it's currently impossible to use FromSql on an entity type that contains a complex JSON column, because of #34627. While we should probably do #34627 properly for 11 (should we move it out of the backlog?), it seems possible to work around this in query for 10.0 - what do you think about the approach (temporary only)?

Note that view-only mapping still doesn't work since there's no mapping whatsoever (i.e. there must be a table mapping) - but that seems much more edge-casey.

@roji
Copy link
Member Author

roji commented Nov 24, 2025

Closing for now, until we see more user signal.

@roji roji closed this Nov 24, 2025
@roji roji reopened this Nov 26, 2025
@roji roji force-pushed the FromSqlComplexTypes branch from 8a8a7e8 to 8c820a1 Compare November 26, 2025 09:27
@roji roji requested a review from AndriySvyryd November 26, 2025 09:28
@roji roji marked this pull request as ready for review November 26, 2025 09:34
@roji roji requested a review from a team as a code owner November 26, 2025 09:34
@roji roji changed the title Work around the lack of complex types in default relational mappings Make FromSql work on entity types containing complex JSON Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant