Skip to content

Conversation

roji
Copy link
Member

@roji roji commented Aug 20, 2025

Part of #31376 and #36296
Continues #36557

Description

This fixes several mainstream scenarios with complex values types, one of EF 10's major new features:

  • Projecting out JSON nullable complex types
  • Translating Nullable<T>.HasValue and Value (including for non-JSON table-splitting, /cc @cincuranet)
  • Adds some test coverage in the area

Customer impact

Queries involving the above query scenarios fail.

How found

Smoke-testing and increasing test coverage.

Regression

No.

Testing

Tests added.

Risk

Low - this mainly touches code that's new in 10 anyway (around complex types).

@roji roji requested review from artl93 and a team August 20, 2025 20:31
@roji roji added the ask-mode label Aug 20, 2025
@SamMonoRT SamMonoRT changed the title Fixes to complex values types [RC2] - Fixes to complex values types Aug 20, 2025
@SamMonoRT SamMonoRT requested a review from Copilot August 20, 2025 20:57
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes several complex value types scenarios in Entity Framework Core 10, specifically addressing issues with JSON nullable complex types and Nullable operations. The fixes enable proper translation of Nullable<T>.HasValue and Value for both JSON and table-splitting scenarios.

Key changes:

  • Moved nullable member translation logic from dedicated translator to main SQL translating visitor
  • Fixed JSON projection handling for nullable value complex types
  • Enhanced test coverage for complex value types scenarios

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
RelationalSqlTranslatingExpressionVisitor.cs Added direct handling of Nullable members (HasValue/Value) in VisitMember method
RelationalSqlTranslatingExpressionVisitor.StructuralEquality.cs Fixed JSON scalar type handling to unwrap nullable types
RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.cs Enhanced CreateJsonShapers to handle nullable value types with proper CLR type parameter
RelationalMemberTranslatorProvider.cs Removed registration of NullableMemberTranslator
NullableMemberTranslator.cs Deleted dedicated nullable member translator class
RelationalProjectionBindingExpressionVisitor.cs Added type nullability handling for structural type projections
RelationalStructuralTypeShaperExpression.cs Changed return types for MakeClrTypeNullable/NonNullable methods
Test files Added comprehensive test coverage for nullable value type scenarios

@roji roji enabled auto-merge (squash) August 20, 2025 23:07
@roji roji merged commit 87cf2b6 into dotnet:release/10.0 Aug 20, 2025
7 checks passed
@roji roji deleted the JsonComplexValueTypes branch August 20, 2025 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants