Skip to content

Conversation

@JoasE
Copy link
Contributor

@JoasE JoasE commented Dec 8, 2025

Sets values for complex properties in the JObject/document of an entity in DocumentSource
Does not create document source for complex types
part of: #37297

  • I've read the guidelines for contributing and seen the walkthrough
  • I've posted a comment on an issue with a detailed description of how I am planning to contribute and got approval from a member of the team
  • The code builds and tests pass locally (also verified by our automated build checks)
  • Commit messages follow this format:
        Summary of the changes
        - Detail 1
        - Detail 2

        Fixes #bugnumber
  • Tests for the changes have been added (for bug fixes / features)
  • Code follows the same patterns and style as existing code in this repo

Sets values for complex properties in the JObject of an entity
Since complex properties do not support shadow properties, and I understood support for __JObject is probably being dropped, the currently don't expose a __JObject property and will always overwrite values in the __JObject
part of: dotnet#37297
@JoasE JoasE changed the title Set complex properties in DocumentSource Cosmos: Update pipeline complex properties Dec 8, 2025
@JoasE JoasE marked this pull request as ready for review December 8, 2025 20:03
@JoasE JoasE requested a review from a team as a code owner December 8, 2025 20:03
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 complex type collections in the Cosmos provider for Entity Framework Core. The changes enable storing, retrieving, and updating complex property collections in Cosmos documents by extending the document pipeline to handle complex types alongside owned entity navigations.

Key Changes:

  • Extended DocumentSource to create and update documents for complex properties (both single and collection)
  • Removed validation that previously blocked complex type collections in Cosmos
  • Refactored GetCurrentProviderValue to an internal extension method for reuse across providers
  • Enabled existing test suites for complex collections in Cosmos

Reviewed changes

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

Show a summary per file
File Description
src/EFCore.Cosmos/Update/Internal/DocumentSource.cs Core implementation for creating/updating documents with complex properties and collections using 0-based indexing
src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs Removed validation error that blocked complex type collections
src/EFCore/Update/UpdateEntryExtensions.cs Refactored to delegate to internal extension method
src/EFCore/Update/Internal/InternalUpdateEntryExtensions.cs New file containing internal extension for getting provider values, shared across providers
src/EFCore.Cosmos/Storage/Internal/CosmosDatabaseWrapper.cs Minor whitespace formatting fix
test/EFCore.Cosmos.FunctionalTests/CosmosComplexTypesTrackingTest.cs New Cosmos-specific test class with tests for complex collection operations
test/EFCore.Specification.Tests/ComplexTypesTrackingTestBase.cs Made methods virtual/protected for provider overrides, refactored tests to use helper methods
test/EFCore.Cosmos.Tests/Infrastructure/CosmosModelValidatorTest.cs Updated to expect validation to pass for complex collections
test/EFCore.Cosmos.FunctionalTests/ModelBuilding/CosmosModelBuilderGenericTest.cs Removed Skip attributes from complex collection tests
test/EFCore.Cosmos.FunctionalTests/Scaffolding/CompiledModelCosmosTest.cs Uncommented complex collection model configuration
test/EFCore.Cosmos.FunctionalTests/Scaffolding/Baselines/ComplexTypes/*.cs Regenerated baseline files with updated complex type handling and formatting
Comments suppressed due to low confidence (1)

test/EFCore.Specification.Tests/ComplexTypesTrackingTestBase.cs:852

  • Inconsistent indentation. Lines 845-852 have extra leading spaces compared to line 842. These lines should be aligned at the same indentation level as the yogurt variable declaration to maintain consistent formatting within the lambda body.
                if (async)
                {
                    await context.SaveChangesAsync();
                }
                else
                {
                    context.SaveChanges();
                }

Copilot AI review requested due to automatic review settings December 18, 2025 11:08
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 11 out of 13 changed files in this pull request and generated no new comments.

Copy link
Member

@AndriySvyryd AndriySvyryd left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

@AndriySvyryd AndriySvyryd merged commit 5a68c09 into dotnet:main Dec 18, 2025
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants