Skip to content

Add convention builder APIs for JSON mapping - #39513

Merged
AndriySvyryd merged 2 commits into
mainfrom
copilot/convention-json-container-column
Nov 5, 2026
Merged

AndriySvyryd merged 2 commits into
mainfrom
copilot/convention-json-container-column

Conversation

Copilot AI commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Adds convention-builder APIs for JSON container column names/types and JSON property names, updates attribute convention handling and relational validation, and adds relational model-builder tests.

- Add container column and JSON property name configuration APIs\n- Update JSON property name conventions and validation\n- Add relational model-builder coverage

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

🟡 Changes recommended

The change removes a supported finalization extension point, breaking derived custom conventions, and lists nonexistent APIs in the baseline, causing CI baseline validation to fail.

2 open issues
What changed in this PR

Adds convention-builder APIs for JSON mapping in EF Core’s relational layer, allowing conventions to configure container columns and JSON property names with configuration-source precedence.

Changes:

  • Adds complex-type JSON mapping APIs and entity-type container-column APIs.
  • Retains attribute-derived JSON names and adjusts relational validation accordingly.
  • Adds model-building tests and updates the public API baseline.
File Description
test/​EFCore.Relational.Specification.Tests/​ModelBuilding/​RelationalModelBuilderTest.cs Tests convention APIs, precedence, and retained attribute names.
src/​EFCore.Relational/​Metadata/​Conventions/​RelationalPropertyJsonPropertyNameAttributeConvention.cs Uses the new builder API and removes finalization cleanup.
src/​EFCore.Relational/​Infrastructure/​RelationalModelValidator.cs Exempts attribute-configured JSON names from conflicting-mapping checks.
src/​EFCore.Relational/​Extensions/​RelationalEntityTypeBuilderExtensions.cs Adds container-column name and type convention APIs.
src/​EFCore.Relational/​Extensions/​RelationalComplexTypeBuilderExtensions.cs Adds complex-type JSON mapping convention APIs.
src/​EFCore.Relational/​EFCore.Relational.baseline.json Updates API entries for the builders and attribute convention.

Review effort: Balanced

@github-code-quality

github-code-quality Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: C#

C# / code-coverage

main cb885fc copilot/convention-j... 05d6512 +/-
76% 76% 0%
View coverage of the 10 most impacted files.
File main cb885fc copilot/convention-j... 05d6512 +/-
src/Microsoft.D...nnectionPool.cs 100% 97% -3%
src/EFCore.Desi...odeGenerator.cs 92% 91% -1%
src/EFCore.Rela...alConnection.cs 94% 93% -1%
src/EFCore/Meta...xTypeBuilder.cs 34% 33% -1%
src/EFCore.Rela...erExtensions.cs 88% 89% +1%
src/EFCore.Rela...erExtensions.cs 47% 50% +3%
src/EFCore.Rela...nMappingBase.cs 78% 91% +13%
src/EFCore.Rela...BaseComparer.cs 0% 33% +33%
src/EFCore.Rela...BaseComparer.cs 0% 65% +65%
src/EFCore.Rela...erExtensions.cs 0% 92% +92%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated November 05, 2026 12:07 UTC

@AndriySvyryd
AndriySvyryd marked this pull request as ready for review November 4, 2026 03:45
@AndriySvyryd
AndriySvyryd requested a review from a team as a code owner November 4, 2026 03:45
@AndriySvyryd
AndriySvyryd enabled auto-merge (squash) November 4, 2026 03:46
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
auto-merge was automatically disabled November 4, 2026 03:51

Head branch was pushed to by a user without write access

Copilot AI balanced review requested due to automatic review settings November 4, 2026 03:51
Copilot AI requested a review from AndriySvyryd November 4, 2026 03:52

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.

🟢 Approval recommended

No active review issues are reported for the convention-based JSON mapping changes.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@AndriySvyryd
AndriySvyryd merged commit 58c38fa into main Nov 5, 2026
20 of 23 checks passed
@AndriySvyryd
AndriySvyryd deleted the copilot/convention-json-container-column branch November 5, 2026 13:20
@github-actions github-actions Bot added the api-review This PR or issue is introducing public API changes that need to be reviewed label Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

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

Show diff

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

+ static class Microsoft.EntityFrameworkCore.RelationalComplexTypeBuilderExtensions
+ static bool CanSetContainerColumnName(this IConventionComplexTypeBuilder complexTypeBuilder, string? columnName, bool fromDataAnnotation = false);
+ static bool CanSetContainerColumnType(this IConventionComplexTypeBuilder complexTypeBuilder, string? columnType, bool fromDataAnnotation = false);
+ static bool CanSetJsonPropertyName(this IConventionComplexTypeBuilder complexTypeBuilder, string? name, bool fromDataAnnotation = false);
+ static IConventionComplexTypeBuilder? HasContainerColumnName(this IConventionComplexTypeBuilder complexTypeBuilder, string? columnName,
+     bool fromDataAnnotation = false);
+ static IConventionComplexTypeBuilder? HasContainerColumnType(this IConventionComplexTypeBuilder complexTypeBuilder, string? columnType,
+     bool fromDataAnnotation = false);
+ static IConventionComplexTypeBuilder? HasJsonPropertyName(this IConventionComplexTypeBuilder complexTypeBuilder, string? name,
+     bool fromDataAnnotation = false);
  static class Microsoft.EntityFrameworkCore.RelationalEntityTypeBuilderExtensions
+ static bool CanSetContainerColumnName(this IConventionEntityTypeBuilder entityTypeBuilder, string? columnName, bool fromDataAnnotation = false);
+ static bool CanSetContainerColumnType(this IConventionEntityTypeBuilder entityTypeBuilder, string? columnType, bool fromDataAnnotation = false);
+ static IConventionEntityTypeBuilder? HasContainerColumnName(this IConventionEntityTypeBuilder entityTypeBuilder, string? columnName,
+     bool fromDataAnnotation = false);
+ static IConventionEntityTypeBuilder? HasContainerColumnType(this IConventionEntityTypeBuilder entityTypeBuilder, string? columnType,
+     bool fromDataAnnotation = false);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-review This PR or issue is introducing public API changes that need to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants