-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Cosmos: Update pipeline complex properties #37322
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
Cosmos: Update pipeline complex properties #37322
Conversation
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
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 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
DocumentSourceto create and update documents for complex properties (both single and collection) - Removed validation that previously blocked complex type collections in Cosmos
- Refactored
GetCurrentProviderValueto 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();
}
test/EFCore.Specification.Tests/ComplexTypesTrackingTestBase.cs
Outdated
Show resolved
Hide resolved
test/EFCore.Specification.Tests/ComplexTypesTrackingTestBase.cs
Outdated
Show resolved
Hide resolved
…cosmos-complex-properties-update
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
Copilot reviewed 11 out of 13 changed files in this pull request and generated no new comments.
AndriySvyryd
left a comment
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.
Thanks for your contribution!
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