Skip to content

Conversation

@roji
Copy link
Member

@roji roji commented Feb 7, 2026

@AndriySvyryd there's some additional potential cleanup/refactor, but this is a solid 1st step - let me know what you think. I suggest we iterate here with whatever works fastest, i.e. if you want changes, it's probably better to check this out and do them (or ask copilot to do them) rather than comment (as this more your owned area in any case). But am open to doing it in whatever way you prefer.

Closes #37645

@roji roji force-pushed the ModelValidation branch 2 times, most recently from b9272a8 to f025731 Compare February 8, 2026 21:14
@roji roji marked this pull request as ready for review February 8, 2026 21:33
@roji roji requested a review from a team as a code owner February 8, 2026 21:34
Copilot AI review requested due to automatic review settings February 8, 2026 21:34
Copy link

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

Refactors EF Core model validation to avoid repeated full-model iterations by validating per-entity (and per-member) in a single pass, and updates provider-specific validators/tests to align with the new validation flow.

Changes:

  • Refactored ModelValidator to perform validation via a single iteration over entity types and added per-entity/per-property/per-index extension points.
  • Updated relational, SQL Server, SQLite, and Cosmos validators to plug into the new per-entity/per-member validation pipeline.
  • Adjusted tests across providers to reflect new validation behavior (e.g., discriminator setup, stored-procedure unsupported behavior, decimal warning handling).

Reviewed changes

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

Show a summary per file
File Description
src/EFCore/Infrastructure/ModelValidator.cs Core refactor to validate entity types in one pass; introduces per-entity/property/index/trigger validation hooks.
src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs Moves many relational validations into per-entity/per-property/per-key overrides; adds stored procedure sharing and sequence validation.
src/EFCore.SqlServer/Infrastructure/Internal/SqlServerModelValidator.cs Splits SQL Server validations into per-entity/per-property/per-index checks (temporal, decimal, vector, include properties).
src/EFCore.Sqlite.Core/Infrastructure/Internal/SqliteModelValidator.cs Updates SQLite validation to run per-entity and per-sequence and to throw for stored procedures early.
src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs Reorganizes Cosmos validations into per-entity/per-property/per-index/trigger overrides.
test/EFCore.Tests/Infrastructure/ModelValidatorTest.cs Updates inheritance-related tests to explicitly configure discriminators.
test/EFCore.Relational.Tests/Infrastructure/RelationalModelValidatorTest.cs Adjusts entity-splitting test to use a derived-type property.
test/EFCore.Sqlite.Tests/Infrastructure/SqliteModelValidatorTest.cs Overrides additional stored-procedure tests to expect SQLite “not supported” behavior.
test/EFCore.SqlServer.FunctionalTests/PropertyValuesSqlServerTest.cs Sets explicit column types for decimal properties inside complex types.
test/EFCore.SqlServer.FunctionalTests/LazyLoadProxySqlServerTest.cs Ignores DecimalTypeDefaultWarning via fixture options.
test/EFCore.SqlServer.FunctionalTests/ComplexTypesTrackingSqlServerTest.cs Uses primary constructor for base test class and ignores DecimalTypeDefaultWarning.
test/EFCore.Relational.Specification.Tests/Query/AdHocAdvancedMappingsQueryRelationalTestBase.cs Changes complex-type payment fields from decimal to double.

Copilot AI review requested due to automatic review settings February 8, 2026 21:48
Copy link

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

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings February 10, 2026 02:00
Copy link

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

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

Copy link

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

Copilot reviewed 22 out of 23 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • src/EFCore.Relational/Properties/RelationalStrings.Designer.cs: Language not supported

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.

Refactor model validation to stop looping for every check

2 participants