Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 2, 2025

Fixes #37274

Description
The TableSharingConcurrencyTokenConvention was incorrectly adding shadow concurrency token properties to JSON-mapped owned entities causing model validation to fail.

// This fails in EF Core 10 but worked in 9.x
public abstract class BaseEntity
{
    public int Id { get; set; }
    public long RowVersion { get; set; } // IsRowVersion
}

public class DerivedEntity : BaseEntity
{
    public OwnedEntity Owned { get; set; } // Mapped with ToJson()
}

Customer impact
Apps using TPH inheritance with a concurrency token in the base class and a JSON-mapped owned entity in a derived class get an exception during model building. There is no known workaround other than removing either the concurrency token or the JSON mapping.

How found
Customer reported on EF 10. Not a common scenario.

Regression
Yes, from EF Core 9.x.

Testing
Test added.

Risk
Low. Targeted fix for the affected scenario.

Original prompt

Fix #37274


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Skip adding shadow concurrency token properties to entities that are
mapped to JSON columns. JSON-mapped entities use JSON property names,
not column names, and adding a column-mapped property causes model
validation to fail.

Fixes #37274

Co-authored-by: AndriySvyryd <[email protected]>
Copilot AI changed the title [WIP] Fix issue 37274 in Entity Framework Core Fix TableSharingConcurrencyTokenConvention to skip JSON-mapped entities Dec 2, 2025
Copilot finished work on behalf of AndriySvyryd December 2, 2025 22:31
Copilot AI requested a review from AndriySvyryd December 2, 2025 22:31
@AndriySvyryd
Copy link
Member

@copilot Update progress by rewriting the PR summary using this template:

Fixes #{number}

**Description**
{Issue description}

**Customer impact**
{How does the reported issue affects customer's app? Are there workarounds?}

**How found**
{Was it customer reported or found during verification? How many customers are affected?}

**Regression**
{Is it a regression from a released version? Which one?}

**Testing**
{How the changes were tested}

**Risk**
{Low/Medium/High, argument why}

Copy link
Contributor Author

Copilot AI commented Dec 3, 2025

@copilot Update progress by rewriting the PR summary using this template:

...

Updated the PR description with the requested template format.

@AndriySvyryd AndriySvyryd changed the title Fix TableSharingConcurrencyTokenConvention to skip JSON-mapped entities [release/10.0] Fix TableSharingConcurrencyTokenConvention to skip JSON-mapped entities Dec 3, 2025
Copilot AI changed the title [release/10.0] Fix TableSharingConcurrencyTokenConvention to skip JSON-mapped entities Fix TableSharingConcurrencyTokenConvention to skip JSON-mapped entities Dec 3, 2025
Copilot finished work on behalf of AndriySvyryd December 3, 2025 02:46
@AndriySvyryd AndriySvyryd changed the title Fix TableSharingConcurrencyTokenConvention to skip JSON-mapped entities [release/10.0] Fix TableSharingConcurrencyTokenConvention to skip JSON-mapped entities Dec 3, 2025
@AndriySvyryd AndriySvyryd marked this pull request as ready for review December 3, 2025 02:55
@AndriySvyryd AndriySvyryd requested a review from a team as a code owner December 3, 2025 02:55
@AndriySvyryd AndriySvyryd requested a review from artl93 December 5, 2025 02:15
@AndriySvyryd
Copy link
Member

cc @artl93

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.

4 participants