Add IUpdateAdapter.CreateEntry overload that works with non-collection complex properties#38367
Open
AndriySvyryd wants to merge 1 commit into
Open
Add IUpdateAdapter.CreateEntry overload that works with non-collection complex properties#38367AndriySvyryd wants to merge 1 commit into
AndriySvyryd wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new IUpdateAdapter.CreateEntry overload that accepts a dictionary keyed by IProperty, allowing values to be supplied unambiguously for multiple complex properties sharing the same complex type (where name-keyed dictionaries are insufficient). It obsoletes the existing name-keyed overload and updates internal call sites and tests accordingly.
Changes:
- Add
CreateEntry(IReadOnlyDictionary<IProperty, object?>, IEntityType)overload and obsolete the existingCreateEntry(IDictionary<string, object?>, IEntityType). - Update
StateManager/InternalEntityEntryconstruction path and add tests verifying correct disambiguation for duplicate complex types and proper validation. - Update seeding paths (InMemory, Cosmos) to use the new overload and refresh the API baseline.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/EFCore.Tests/TestUtilities/FakeStateManager.cs | Adds the new CreateEntry overload to the test double. |
| test/EFCore.Tests/ChangeTracking/Internal/StateManagerTest.cs | Adds regression tests for duplicate complex type properties and validation of foreign properties. |
| test/EFCore.Tests/ChangeTracking/Internal/InternalEntityEntryTestBase.cs | Switches core entry-creation tests to the new overload; keeps name-keyed overload tests as obsolete. |
| src/EFCore/Update/IUpdateAdapter.cs | Introduces the new overload and marks the old overload obsolete. |
| src/EFCore/Update/Internal/UpdateAdapter.cs | Implements the new overload and forwards obsolete calls with warning suppression. |
| src/EFCore/EFCore.baseline.json | Marks the old overload obsolete and adds the new API signature to the baseline. |
| src/EFCore/ChangeTracking/Internal/StateManager.cs | Adds/obsoletes CreateEntry overloads and routes to InternalEntityEntry. |
| src/EFCore/ChangeTracking/Internal/IStateManager.cs | Adds the new overload and obsoletes the old one. |
| src/EFCore/ChangeTracking/Internal/InternalEntityEntry.cs | Adds an IProperty-keyed constructor for value-buffer materialization. |
| src/EFCore.InMemory/Storage/Internal/InMemoryStore.cs | Updates seeding to use the new overload via an IProperty-keyed map. |
| src/EFCore.Cosmos/Storage/Internal/CosmosDatabaseCreator.cs | Updates seeding to use the new overload via an IProperty-keyed map. |
…n complex properties Fixes #37846
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #37846