Skip to content

Apply feedback from API review - #38438

Merged
AndriySvyryd merged 7 commits into
mainfrom
copilot/fix-remaining-tasks-37993
Jun 17, 2026
Merged

AndriySvyryd merged 7 commits into
mainfrom
copilot/fix-remaining-tasks-37993

Conversation

Copilot AI commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Part of #37993

This change corrects API targeting and naming around relational join/json-index helpers. AddInnerJoin overloads are left as fully public, and JSON-index detection/construction paths are split more cleanly between caller filtering and helper logic.

  • Join overload visibility contract

    • Removed [EntityFrameworkInternal] from all AddInnerJoin overloads — both AddInnerJoin(SelectExpression, SqlExpression) and AddInnerJoin(ShapedQueryExpression, SqlExpression, Expression, bool, bool) are fully public.
  • JSON index shape detection extraction

    • Converted JSON-index detection into an extension method (IsJsonIndex) on relational index extensions.
    • Centralizes "is this a JSON index shape?" logic instead of keeping it embedded in RelationalAnnotationProvider.
  • Provider method refactor

    • Renamed ConvertToJsonIndex to CreateJsonIndex(IIndex modelIndex, ITableIndex tableIndex) in RelationalAnnotationProvider.
    • Removed the single-arg CreateJsonIndex(IIndex index) overload; IsJsonIndex() is now called directly at the call site in a foreach loop.
    • CreateJsonIndex now focuses only on building the RelationalJsonIndex from a confirmed JSON index shape, using the current mapped table index passed from the caller.
  • StructuredJsonPath wildcard API

    • Changed wildcardForNullIndex parameter type from char to char? with a default of null. null renders unspecified array indices as []; any non-null char renders as [x]. The parameterless override ToString() passes '*' explicitly to preserve the existing [*] default output.
  • API baseline alignment

    • Updated relational baseline entries to reflect CreateJsonIndex(IIndex modelIndex, ITableIndex tableIndex) replacing the two previous overloads, and the updated AppendTo/ToString signatures with char?.
// Caller loop in For(ITableIndex, bool)
IIndex? modelIndex = null;
foreach (var mappedIndex in index.MappedIndexes)
{
    if (mappedIndex.IsJsonIndex())
    {
        modelIndex = mappedIndex;
        break;
    }
}

// Simplified builder
protected virtual RelationalJsonIndex CreateJsonIndex(IIndex modelIndex, ITableIndex tableIndex)
{
    // ...
}

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 PR aligns internal/public (“pubternal”) API marking for relational join helpers, and refactors relational JSON-index detection so shape recognition and JSON-element resolution are split more cleanly. It also updates related APIs/call sites, baselines, and tests (including a SQL Server warning rename and a StructuredJsonPath rendering tweak).

Changes:

  • Marked the intended SelectExpression.AddInnerJoin(..., bool toOneJoin = false, bool prunableJoin = false) overload as [EntityFrameworkInternal], aligning the extensibility/visibility contract.
  • Extracted JSON-index shape detection into RelationalIndexExtensions.IsJsonIndex() and renamed/refactored JSON-index construction APIs in RelationalAnnotationProvider (with baseline updates).
  • Renamed the SQL Server vector-search warning event id/methods and updated resources + functional tests; updated StructuredJsonPath to support customizable/empty wildcards for null array indices.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/EFCore.Tests/Infrastructure/StructuredJsonPathTest.cs Adds coverage for custom/empty wildcard rendering for null array indices.
test/EFCore.SqlServer.FunctionalTests/Query/Translations/VectorTranslationsSqlServerTest.cs Updates assertions/config for renamed vector-search warning event id.
src/EFCore/Metadata/Conventions/ForeignKeyIndexConvention.cs Adjusts FK/index coverage logic to exclude JSON-path indexes via CollectionIndices.
src/EFCore/EFCore.baseline.json Removes baseline entry for deleted IsNonComplexCollectionIndex.
src/EFCore.SqlServer/Query/Internal/SqlServerVectorSearchWithoutApproximateDetector.cs Logs renamed vector-search warning.
src/EFCore.SqlServer/Properties/SqlServerStrings.resx Updates warning text/comment to reference renamed event id.
src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs Updates generated logging definition to use renamed event id.
src/EFCore.SqlServer/Migrations/SqlServerMigrationsSqlGenerator.cs Updates StructuredJsonPath.ToString(...) call to new wildcard parameter.
src/EFCore.SqlServer/Extensions/Internal/SqlServerLoggerExtensions.cs Renames logger extension method for the vector-search warning.
src/EFCore.SqlServer/EFCore.SqlServer.baseline.json Updates baseline for renamed SQL Server event id field.
src/EFCore.SqlServer/Diagnostics/SqlServerEventId.cs Renames the event id constant (without changing numeric value).
src/EFCore.Relational/Query/SqlExpressions/SelectExpression.cs Applies [EntityFrameworkInternal] to the intended AddInnerJoin overload(s).
src/EFCore.Relational/Metadata/RelationalAnnotationProvider.cs Refactors JSON-index detection/construction flow; introduces CreateJsonIndex APIs.
src/EFCore.Relational/Metadata/Internal/RelationalIndexExtensions.cs Adds IsJsonIndex() extension for centralized JSON-index shape detection.
src/EFCore.Relational/Infrastructure/StructuredJsonPath.cs Changes null-array-index rendering from bool flag to configurable wildcard char.
src/EFCore.Relational/EFCore.Relational.baseline.json Updates baselines for renamed JSON-index APIs and StructuredJsonPath signatures.
Files not reviewed (1)
  • src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs: Generated file

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 15 out of 16 changed files in this pull request and generated 8 comments.

Files not reviewed (1)
  • src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs: Generated file
Comments suppressed due to low confidence (1)

src/EFCore.SqlServer/Extensions/Internal/SqlServerLoggerExtensions.cs:651

  • This method rename is a breaking change for any callers using the previous VectorSearchWithoutApproximateWarning extension. Consider keeping the old method name as an [Obsolete] wrapper delegating to the new method.
    public static void VectorSearchWithoutApproximateIndexWarning(
        this IDiagnosticsLogger<DbLoggerCategory.Query> diagnostics,
        string propertyName,
        string entityTypeName)
    {

Comment thread src/EFCore/EFCore.baseline.json Resolved
…actor, remove pubternal from AddInnerJoin

Co-authored-by: AndriySvyryd <[email protected]>
Copilot AI changed the title Align AddInnerJoin pubternal overload and JSON-index helper API Align AddInnerJoin API visibility and JSON-index helper refactoring Jun 17, 2026
Copilot AI requested a review from AndriySvyryd June 17, 2026 03:03
@AndriySvyryd
AndriySvyryd requested a review from Copilot June 17, 2026 04:31

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 14 out of 15 changed files in this pull request and generated 7 comments.

Files not reviewed (1)
  • src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs: Generated file

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@AndriySvyryd
AndriySvyryd marked this pull request as ready for review June 17, 2026 05:10
@AndriySvyryd
AndriySvyryd requested a review from a team as a code owner June 17, 2026 05:10
Copilot AI review requested due to automatic review settings June 17, 2026 05:10
@AndriySvyryd AndriySvyryd changed the title Align AddInnerJoin API visibility and JSON-index helper refactoring Apply feedback from API review Jun 17, 2026
@AndriySvyryd
AndriySvyryd requested a review from cincuranet June 17, 2026 05:11

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 14 out of 15 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs: Generated file

@AndriySvyryd
AndriySvyryd merged commit 186d970 into main Jun 17, 2026
24 of 25 checks passed
@AndriySvyryd
AndriySvyryd deleted the copilot/fix-remaining-tasks-37993 branch June 17, 2026 16:00
@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.Relational/EFCore.Relational.baseline.json

Show diff

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

  class Microsoft.EntityFrameworkCore.Infrastructure.StructuredJsonPath
- virtual StringBuilder AppendTo(StringBuilder builder, bool useAsteriskForNullIndex = true);
+ virtual StringBuilder AppendTo(StringBuilder builder, char? wildcardForNullIndex = null);
- virtual string ToString(bool useAsteriskForNullIndex = true);
+ virtual string ToString(char? wildcardForNullIndex = null);
  class Microsoft.EntityFrameworkCore.Metadata.RelationalAnnotationProvider : Microsoft.EntityFrameworkCore.Metadata.IRelationalAnnotationProvider
- virtual bool IsJsonIndex(IIndex index);
- virtual RelationalJsonIndex? TryBuildJsonIndex(ITableIndex index);
+ virtual RelationalJsonIndex CreateJsonIndex(IIndex modelIndex, ITableIndex tableIndex);

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

Show diff

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

  static class Microsoft.EntityFrameworkCore.Diagnostics.SqlServerEventId
- static readonly Microsoft.Extensions.Logging.EventId VectorSearchWithoutApproximateWarning
+ static readonly Microsoft.Extensions.Logging.EventId VectorSearchWithoutApproximateIndexWarning

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.Metadata.Conventions.ForeignKeyIndexConvention :
      Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IConvention,
      Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyRemovedConvention,
      Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyPropertiesChangedConvention,
      Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyUniquenessChangedConvention,
      Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyRemovedConvention,
      Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeBaseTypeChangedConvention,
      Microsoft.EntityFrameworkCore.Metadata.Conventions.IIndexAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IIndexRemovedConvention,
      Microsoft.EntityFrameworkCore.Metadata.Conventions.IIndexUniquenessChangedConvention,
      Microsoft.EntityFrameworkCore.Metadata.Conventions.IModelFinalizingConvention
- static bool IsNonComplexCollectionIndex(IConventionIndex index);

@AndriySvyryd AndriySvyryd removed the api-review This PR or issue is introducing public API changes that need to be reviewed label Jun 17, 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.

4 participants