Skip to content

API review follow-ups: rename full-text/vector builder methods, remove IndexBuilder extensions, collapse TVF overloads#38027

Open
roji wants to merge 1 commit intodotnet:mainfrom
roji:ApiReview
Open

API review follow-ups: rename full-text/vector builder methods, remove IndexBuilder extensions, collapse TVF overloads#38027
roji wants to merge 1 commit intodotnet:mainfrom
roji:ApiReview

Conversation

@roji
Copy link
Copy Markdown
Member

@roji roji commented Mar 28, 2026

Implements the @roji-tagged items from #37993:

  • Move FullTextSearchResult to Microsoft.EntityFrameworkCore.Query namespace
  • SqlServerFullTextIndexBuilder: HasKeyIndexUseKeyIndex, OnCatalogUseCatalog, WithChangeTrackingHasChangeTracking, HasLanguageUseLanguage; remove Name suffix from params
  • SqlServerVectorIndexBuilder: UseMetricHasMetric, UseTypeHasType
  • Remove HasFullTextKeyIndex/HasFullTextCatalog/HasFullTextChangeTracking/HasFullTextLanguage IndexBuilder extension methods (keep IConventionIndexBuilder overloads with renamed params)
  • Collapse ContainsTable/FreeTextTable overloads by moving columnSelector after search text and making it optional
  • Update annotation code generator, resource strings, and all tests

Two items from the issue are deferred for separate investigation:

  • AOT suppression on EntityFrameworkQueryableExtensions (Feb 24)
  • Validate unsupported Metadata API configuration (Mar 23)

Part of #37993

…e IndexBuilder extensions, collapse TVF overloads

Implements the @roji-tagged items from dotnet#37993:

- Move FullTextSearchResult to Microsoft.EntityFrameworkCore.Query namespace
- SqlServerFullTextIndexBuilder: HasKeyIndex→UseKeyIndex, OnCatalog→UseCatalog,
  WithChangeTracking→HasChangeTracking, HasLanguage→UseLanguage
- SqlServerVectorIndexBuilder: UseMetric→HasMetric, UseType→HasType
- Remove HasFullTextKeyIndex/Catalog/ChangeTracking/Language IndexBuilder extensions
  (keep IConventionIndexBuilder overloads with renamed params)
- Collapse ContainsTable/FreeTextTable overloads by moving columnSelector after
  search text and making it optional
- Update annotation code generator, resource strings, and all tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@roji roji requested a review from a team as a code owner March 28, 2026 09:33
Copilot AI review requested due to automatic review settings March 28, 2026 09:33
Copy link
Copy Markdown

Copilot AI left a comment

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 applies SQL Server API review follow-ups for EF Core 11.0 around full-text and vector indexing, including API renames, removal of IndexBuilder-based full-text configuration extensions, and a simplified TVF surface for FREETEXTTABLE/CONTAINSTABLE. It also moves FullTextSearchResult into the .Query namespace and updates generators/resources/tests accordingly.

Changes:

  • Rename fluent builder methods for full-text (UseKeyIndex, UseCatalog, HasChangeTracking, UseLanguage) and vector indexes (HasMetric, HasType), and update tests/resources.
  • Remove IndexBuilder full-text extension methods (keeping IConventionIndexBuilder variants) and update the annotation code generator output.
  • Collapse FreeTextTable/ContainsTable overloads by reordering and making columnSelector optional; update translation tests.

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.SqlServer.Tests/Infrastructure/SqlServerModelValidatorTest.cs Updates vector/full-text builder method names in model validation tests.
test/EFCore.SqlServer.Tests/Design/Internal/SqlServerAnnotationCodeGeneratorTest.cs Updates expected fluent API method names produced by the annotation generator.
test/EFCore.SqlServer.FunctionalTests/Scaffolding/CompiledModelSqlServerTest.cs Updates compiled model scaffolding tests for renamed builder methods.
test/EFCore.SqlServer.FunctionalTests/Query/Translations/FullTextSearchTranslationsSqlServerTest.cs Updates TVF usage to new parameter order (searchText first, optional selector).
test/EFCore.SqlServer.FunctionalTests/ModelBuilding/SqlServerModelBuilderTestBase.cs Updates fluent API tests and test builder wrappers for renamed methods.
test/EFCore.SqlServer.FunctionalTests/Migrations/MigrationsSqlServerTest.cs Updates migration-model building tests to renamed methods.
src/EFCore.SqlServer/Properties/SqlServerStrings.resx Updates user-facing messages to reference renamed APIs.
src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs Regenerated/designer updates for renamed API references in XML docs.
src/EFCore.SqlServer/Metadata/Builders/SqlServerVectorIndexBuilder`1.cs Renames vector index builder methods to HasMetric/HasType.
src/EFCore.SqlServer/Metadata/Builders/SqlServerVectorIndexBuilder.cs Renames vector index builder methods to HasMetric/HasType.
src/EFCore.SqlServer/Metadata/Builders/SqlServerFullTextIndexBuilder`1.cs Renames full-text index builder methods/parameter names per API review.
src/EFCore.SqlServer/Metadata/Builders/SqlServerFullTextIndexBuilder.cs Renames full-text index builder methods/parameter names per API review.
src/EFCore.SqlServer/Extensions/SqlServerQueryableExtensions.cs Collapses TVF overloads by reordering/making selector optional; updates docs and provider checks.
src/EFCore.SqlServer/Extensions/SqlServerIndexBuilderExtensions.cs Removes IndexBuilder full-text extensions; keeps IConventionIndexBuilder APIs with renamed params.
src/EFCore.SqlServer/Extensions/FullTextSearchResult.cs Moves FullTextSearchResult into Microsoft.EntityFrameworkCore.Query and updates cref signatures.
src/EFCore.SqlServer/Design/Internal/SqlServerAnnotationCodeGenerator.cs Updates fluent API generation to emit renamed full-text builder methods.
Files not reviewed (1)
  • src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs: Language not supported

Comment on lines 162 to +176
private static readonly MethodInfo IndexHasFullTextKeyIndexMethodInfo
= typeof(SqlServerIndexBuilderExtensions).GetRuntimeMethod(
nameof(SqlServerIndexBuilderExtensions.HasFullTextKeyIndex), [typeof(IndexBuilder), typeof(string)])!;
= typeof(SqlServerFullTextIndexBuilder).GetRuntimeMethod(
nameof(SqlServerFullTextIndexBuilder.UseKeyIndex), [typeof(string)])!;

private static readonly MethodInfo IndexHasFullTextCatalogMethodInfo
= typeof(SqlServerIndexBuilderExtensions).GetRuntimeMethod(
nameof(SqlServerIndexBuilderExtensions.HasFullTextCatalog), [typeof(IndexBuilder), typeof(string)])!;
= typeof(SqlServerFullTextIndexBuilder).GetRuntimeMethod(
nameof(SqlServerFullTextIndexBuilder.UseCatalog), [typeof(string)])!;

private static readonly MethodInfo IndexHasFullTextChangeTrackingMethodInfo
= typeof(SqlServerIndexBuilderExtensions).GetRuntimeMethod(
nameof(SqlServerIndexBuilderExtensions.HasFullTextChangeTracking), [typeof(IndexBuilder), typeof(FullTextChangeTracking)])!;
= typeof(SqlServerFullTextIndexBuilder).GetRuntimeMethod(
nameof(SqlServerFullTextIndexBuilder.HasChangeTracking), [typeof(FullTextChangeTracking)])!;

private static readonly MethodInfo IndexHasFullTextLanguageMethodInfo
= typeof(SqlServerIndexBuilderExtensions).GetRuntimeMethod(
nameof(SqlServerIndexBuilderExtensions.HasFullTextLanguage), [typeof(IndexBuilder), typeof(string), typeof(string)])!;
= typeof(SqlServerFullTextIndexBuilder).GetRuntimeMethod(
nameof(SqlServerFullTextIndexBuilder.UseLanguage), [typeof(string), typeof(string)])!;
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SqlServerAnnotationCodeGenerator now uses MethodInfos for instance methods on SqlServerFullTextIndexBuilder (e.g. UseKeyIndex, UseCatalog). The migrations snapshot generator applies index annotation fluent API calls to an IndexBuilder created via EntityTypeBuilder.HasIndex(...); chaining these instance methods onto an IndexBuilder will produce uncompilable snapshot code. Either keep generating static/extension methods that target IndexBuilder, or (preferred given the API removal) introduce a SQL Server-specific snapshot generator that emits HasFullTextIndex(...) (returning SqlServerFullTextIndexBuilder) for full-text indexes and then chains these instance methods; ensure design-time services register it.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/cc @AndriySvyryd what do you think?

Comment on lines +8 to +9
/// <see cref="SqlServerQueryableExtensions.FreeTextTable{T, TKey}(DbSet{T}, string, Expression{Func{T, object}}?, string?, int?)" /> or
/// <see cref="SqlServerQueryableExtensions.ContainsTable{T, TKey}(DbSet{T}, string, Expression{Func{T, object}}?, string?, int?)" />.
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FullTextSearchResult was moved to the Microsoft.EntityFrameworkCore.Query namespace, but there are still internal SQL Server query pipeline references using the unqualified type name (e.g. SqlServerQueryableMethodTranslatingExpressionVisitor), which will no longer compile without updating the namespace/imports. Please update remaining references to the new namespace (add using Microsoft.EntityFrameworkCore.Query; or fully-qualify).

Suggested change
/// <see cref="SqlServerQueryableExtensions.FreeTextTable{T, TKey}(DbSet{T}, string, Expression{Func{T, object}}?, string?, int?)" /> or
/// <see cref="SqlServerQueryableExtensions.ContainsTable{T, TKey}(DbSet{T}, string, Expression{Func{T, object}}?, string?, int?)" />.
/// <see cref="Microsoft.EntityFrameworkCore.SqlServerQueryableExtensions.FreeTextTable{T, TKey}(DbSet{T}, string, Expression{Func{T, object}}?, string?, int?)" /> or
/// <see cref="Microsoft.EntityFrameworkCore.SqlServerQueryableExtensions.ContainsTable{T, TKey}(DbSet{T}, string, Expression{Func{T, object}}?, string?, int?)" />.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot please add using Microsoft.EntityFrameworkCore.Query; as necessary

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