Skip to content

Conversation

@JoasE
Copy link
Contributor

@JoasE JoasE commented Dec 18, 2025

Adds a CosmosStructuralTypeMaterializerSource and overrides AddStructuralTypeInitialization in CosmosShapedQueryCompilingExpressionVisitor to generate materialization expressions for complex properties
Leverages Nullable<>.HasValue for nullable value types in to support value types without equals operator
Part of: #31253

@JoasE

This comment was marked as resolved.

@JoasE JoasE marked this pull request as ready for review December 19, 2025 11:53
@JoasE JoasE requested a review from a team as a code owner December 19, 2025 11:53
Copilot AI review requested due to automatic review settings December 19, 2025 11:53
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 pull request implements binding logic for complex properties in the Cosmos DB provider, enabling proper materialization of complex types from JSON documents. The implementation introduces a custom CosmosStructuralTypeMaterializerSource that defers complex property handling to allow nested materialization expressions to be generated during query compilation.

Key changes:

  • Introduces CosmosStructuralTypeMaterializerSource to control when complex properties are materialized during shaping
  • Implements nested complex property and collection binding in CosmosShapedQueryCompilingExpressionVisitor
  • Enhances null-handling logic in CosmosProjectionBindingExpressionVisitor for nullable value types

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
src/EFCore.Cosmos/Query/Internal/CosmosStructuralTypeMaterializerSource.cs New class that overrides complex type materialization behavior to enable deferred binding
src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.cs Adds logic to generate materialization expressions for complex properties and collections from JObject/JArray
src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.CosmosProjectionBindingRemovingExpressionVisitorBase.cs Exposes methods and fields needed for complex property binding; adds handling for ComplexPropertyBindingExpression
src/EFCore.Cosmos/Query/Internal/CosmosProjectionBindingExpressionVisitor.cs Improves null-safety checks for nullable value types and refactors member expression updates
src/EFCore.Cosmos/Extensions/CosmosServiceCollectionExtensions.cs Registers the new CosmosStructuralTypeMaterializerSource service
test/EFCore.Cosmos.FunctionalTests/CosmosComplexTypesTrackingTest.cs Uncomments assertions that now pass with complex property binding implemented
test/EFCore.Cosmos.FunctionalTests/Query/Associations/ComplexProperties/ComplexPropertiesProjectionCosmosTest.cs New test class with Cosmos-specific overrides for complex property projection tests
test/EFCore.Cosmos.FunctionalTests/Query/Associations/ComplexProperties/ComplexPropertiesCosmosFixture.cs Test fixture configuration for complex properties tests in Cosmos
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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

@JoasE JoasE marked this pull request as draft December 19, 2025 12:33
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

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

@JoasE JoasE marked this pull request as ready for review December 19, 2025 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants