Skip to content

Validate unsupported options on full-text and vector indexes - #38447

Merged
AndriySvyryd merged 3 commits into
mainfrom
copilot/11-0-api-reviews
Jun 19, 2026
Merged

AndriySvyryd merged 3 commits into
mainfrom
copilot/11-0-api-reviews

Conversation

Copilot AI commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Part of #37993

Index options that have no equivalent on the full-text/vector Fluent API (e.g. IsUnique, Filter, IsClustered, DataCompression) could still be set through the Metadata API, where they were silently ignored. This adds model validation so such configuration fails fast.

Changes

  • SqlServerModelValidator: added ValidateUnsupportedIndexOptions, invoked from both ValidateFullTextIndex and ValidateVectorIndex. It throws on the first configured option not supported by the corresponding builder API:
    • Core: IsUnique, IsDescending
    • Relational: Filter
    • SQL Server: IsClustered, IncludeProperties, FillFactor, IsCreatedOnline, SortInTempDb, DataCompression
    • The check runs before other index-specific validations so the unsupported-option error takes precedence.
  • Resources: FullTextIndexUnsupportedOption / VectorIndexUnsupportedOption added to SqlServerStrings.
  • Tests: coverage for full-text (IsUnique) and vector (DataCompression) cases.

Example

modelBuilder.Entity<Blog>(b =>
{
    var index = b.HasFullTextIndex(e => e.Title).UseKeyIndex("PK_Blog");
    index.Metadata.IsUnique = true; // previously ignored, now throws on validation
});

Copilot AI changed the title [WIP] Review changes for 11.0 API release Validate unsupported options on full-text and vector indexes Jun 17, 2026
Copilot AI requested a review from AndriySvyryd June 17, 2026 23:06
@AndriySvyryd
AndriySvyryd requested a review from Copilot June 17, 2026 23:12

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 adds SQL Server model validation to ensure that index options which are not supported for full-text and vector indexes cannot be configured via the Metadata API (where they were previously silently ignored). When such an option is detected, validation now fails fast with a clear provider-specific error message.

Changes:

  • Added a shared ValidateUnsupportedIndexOptions helper in SqlServerModelValidator, invoked for both full-text and vector index validation.
  • Introduced new SQL Server resource strings (FullTextIndexUnsupportedOption, VectorIndexUnsupportedOption) and corresponding designer accessors.
  • Added tests asserting failures for representative unsupported options on full-text (IsUnique) and vector (DataCompression) indexes.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
test/EFCore.SqlServer.Tests/Infrastructure/SqlServerModelValidatorTest.cs Adds validation tests for unsupported options on full-text and vector indexes.
src/EFCore.SqlServer/Properties/SqlServerStrings.resx Adds new localized error message templates for unsupported options.
src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs Adds strongly-typed accessors for the new resource strings.
src/EFCore.SqlServer/Infrastructure/Internal/SqlServerModelValidator.cs Implements and wires up unsupported-option validation for full-text and vector indexes.
Files not reviewed (1)
  • src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs: Generated file

@AndriySvyryd
AndriySvyryd marked this pull request as ready for review June 17, 2026 23:57
@AndriySvyryd
AndriySvyryd requested a review from a team as a code owner June 17, 2026 23:57
@AndriySvyryd
AndriySvyryd requested a review from cincuranet June 17, 2026 23:58
@AndriySvyryd
AndriySvyryd merged commit 6c9904b into main Jun 19, 2026
17 checks passed
@AndriySvyryd
AndriySvyryd deleted the copilot/11-0-api-reviews branch June 19, 2026 18:01
@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