-
Couldn't load subscription status.
- Fork 3.3k
Implement optional complex types #36502
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
Conversation
041a704 to
bc2fef1
Compare
There was a problem hiding this 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
There was a problem hiding this 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.
Part of #31376.
Closes #31412.