Skip to content

Add entry API overloads that work correctly with nullable value properties - #38425

Merged
AndriySvyryd merged 2 commits into
mainfrom
OtherFixes
Jun 17, 2026
Merged

AndriySvyryd merged 2 commits into
mainfrom
OtherFixes

Conversation

@AndriySvyryd

Copy link
Copy Markdown
Member

This pull request introduces new overloads for the ComplexProperty API in EF Core's change tracking system to support nullable value type complex properties, and updates tests and documentation accordingly. It also includes minor documentation fixes and test improvements for better coverage of optional complex properties.

API enhancements for complex property tracking:

  • Added new overloads of ComplexProperty methods in EntityEntry, ComplexPropertyEntry, and ComplexElementEntry classes to support nullable value type (struct?) complex properties, enabling change tracking for optional nested complex properties. [1] [2] [3]

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 extends EF Core change-tracking entry APIs to better support nullable value-type (struct?) complex properties by adding new ComplexProperty(...) overloads on typed entry types, and updates tests/baselines/docs accordingly.

Changes:

  • Added ComplexProperty overloads to EntityEntry<TEntity>, ComplexPropertyEntry<TEntity, TComplexProperty>, and ComplexElementEntry<TEntity, TComplexProperty> for Expression<...TNestedComplexProperty?> with where ... : struct.
  • Updated change-tracking and specification tests to include optional/nullable complex properties in coverage and expectations.
  • Updated public API baseline and fixed minor documentation text.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/EFCore.Tests/ChangeTracking/EntityEntryTest.cs Adds an optional nullable struct complex property to the model and updates entry/member expectations.
test/EFCore.Specification.Tests/PropertyValuesTestBase.cs Extends property-values assertions to cover an additional optional complex property path.
test/EFCore.Specification.Tests/NonSharedModelTestBase.cs Updates the guidance in exception messages thrown when initialization hasn’t occurred.
src/EFCore/Storage/IDatabaseCreator.cs Fixes a small typo in XML documentation.
src/EFCore/EFCore.baseline.json Updates API baseline for newly added overload(s).
src/EFCore/ChangeTracking/EntityEntry`.cs Adds a ComplexProperty overload for nullable value-type complex properties on entity entries.
src/EFCore/ChangeTracking/ComplexPropertyEntry`.cs Adds a ComplexProperty overload for nullable value-type nested complex properties on complex property entries.
src/EFCore/ChangeTracking/ComplexElementEntry`.cs Adds a ComplexProperty overload for nullable value-type nested complex properties on complex element entries.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@AndriySvyryd
AndriySvyryd marked this pull request as ready for review June 13, 2026 04:14
@AndriySvyryd
AndriySvyryd requested a review from a team as a code owner June 13, 2026 04:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

@AndriySvyryd
AndriySvyryd merged commit 0f7ffb2 into main Jun 17, 2026
14 checks passed
@AndriySvyryd
AndriySvyryd deleted the OtherFixes branch June 17, 2026 15:58
@github-actions github-actions Bot added the api-review This PR or issue is introducing public API changes that need to be reviewed label Jun 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

API review baseline changes for src/EFCore/EFCore.baseline.json

Show diff

The diff below was generated by ApiChief between the base and the PR.

  class Microsoft.EntityFrameworkCore.ChangeTracking.ComplexElementEntry<TEntity,
      TComplexProperty> : Microsoft.EntityFrameworkCore.ChangeTracking.ComplexElementEntry where TEntity : class
+ virtual ComplexPropertyEntry<TEntity, TNestedComplexProperty> ComplexProperty<TNestedComplexProperty>(Expression<Func<TComplexProperty,
+     TNestedComplexProperty?>> propertyExpression);

@AndriySvyryd AndriySvyryd removed the api-review This PR or issue is introducing public API changes that need to be reviewed label Jun 23, 2026
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone Jun 23, 2026
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.

3 participants