Skip to content

Add IUpdateAdapter.CreateEntry overload that works with non-collection complex properties#38367

Open
AndriySvyryd wants to merge 1 commit into
mainfrom
Issue37846
Open

Add IUpdateAdapter.CreateEntry overload that works with non-collection complex properties#38367
AndriySvyryd wants to merge 1 commit into
mainfrom
Issue37846

Conversation

@AndriySvyryd

Copy link
Copy Markdown
Member

Fixes #37846

Copilot AI left a comment

Copy link
Copy Markdown

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 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 existing CreateEntry(IDictionary<string, object?>, IEntityType).
  • Update StateManager/InternalEntityEntry construction 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.

Comment thread test/EFCore.Tests/TestUtilities/FakeStateManager.cs
Comment thread src/EFCore/ChangeTracking/Internal/InternalEntityEntry.cs
@AndriySvyryd AndriySvyryd marked this pull request as ready for review June 5, 2026 06:51
@AndriySvyryd AndriySvyryd requested a review from a team as a code owner June 5, 2026 06:51

Copilot AI left a comment

Copy link
Copy Markdown

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 11 changed files in this pull request and generated 1 comment.

Comment thread src/EFCore/ChangeTracking/Internal/InternalEntityEntry.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Manage multiple properties using the same ComplexType in IUpdateAdapter.CreateEntry

2 participants