Skip to content

Conversation

@cincuranet
Copy link
Contributor

Part of #31376.
Closes #31412.

@cincuranet cincuranet force-pushed the optional branch 7 times, most recently from 041a704 to bc2fef1 Compare August 7, 2025 07:56
@cincuranet cincuranet marked this pull request as ready for review August 7, 2025 08:50
@cincuranet cincuranet requested a review from a team as a code owner August 7, 2025 08:50
@cincuranet cincuranet requested a review from Copilot August 7, 2025 08:50
Copy link

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 implements support for optional complex types in Entity Framework Core, addressing part of issue #31376 and closing #31412. The implementation enables complex types to be nullable and allows querying of optional complex types in various scenarios including table splitting, projections, and structural equality comparisons.

Key Changes:

  • Added support for nullable complex type materialization with proper null-checking logic
  • Updated structural type materializer source to handle optional complex types through null checks
  • Enabled complex type projections via optional navigations that were previously blocked
  • Updated test baselines across multiple providers to reflect the new nullable complex type support

Reviewed Changes

Copilot reviewed 35 out of 36 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/EFCore/Query/Internal/StructuralTypeMaterializerSource.cs Core implementation of nullable complex type materialization with null-checking logic
src/EFCore/Query/EntityMaterializerSourceParameters.cs Added AllowNullable parameter to control nullable result behavior
src/EFCore/Query/ShapedQueryCompilingExpressionVisitor.cs Updated to pass nullable information to materializer source
src/EFCore.Relational/Query/SqlExpressions/SelectExpression.cs Removed restrictions on projecting nullable complex types
src/EFCore.Relational/Query/RelationalSqlTranslatingExpressionVisitor.StructuralEquality.cs Removed null comparison restrictions for complex types
src/EFCore.Relational/Query/Internal/RelationalStructuralTypeMaterializerSource.cs Simplified to use base class logic for JSON complex type handling
Multiple test files Updated test baselines and expectations to support optional complex types
Files not reviewed (1)
  • src/EFCore.Relational/Properties/RelationalStrings.Designer.cs: Language not supported

@cincuranet cincuranet merged commit dc2bfe8 into dotnet:main Aug 8, 2025
7 checks passed
Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

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

Congrats on grokking structural type materialization! See below for some comments. @AndriySvyryd please take a look at them too if you can, we may have some small design things to discuss.

@cincuranet cincuranet deleted the optional branch August 11, 2025 10:53
cincuranet added a commit to cincuranet/efcore that referenced this pull request Aug 14, 2025
cincuranet added a commit to cincuranet/efcore that referenced this pull request Aug 14, 2025
cincuranet added a commit to cincuranet/efcore that referenced this pull request Aug 14, 2025
cincuranet added a commit to cincuranet/efcore that referenced this pull request Aug 14, 2025
cincuranet added a commit to cincuranet/efcore that referenced this pull request Aug 14, 2025
cincuranet added a commit to cincuranet/efcore that referenced this pull request Aug 14, 2025
cincuranet added a commit to cincuranet/efcore that referenced this pull request Aug 14, 2025
cincuranet added a commit to cincuranet/efcore that referenced this pull request Aug 14, 2025
cincuranet added a commit to cincuranet/efcore that referenced this pull request Aug 14, 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.

Support for complex types projected via optional navigations

4 participants