-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Redo model validation to stop looping for every check #37646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
b9272a8 to
f025731
Compare
There was a problem hiding this 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
ModelValidatorto 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. |
.../EFCore.Relational.Specification.Tests/Query/AdHocAdvancedMappingsQueryRelationalTestBase.cs
Show resolved
Hide resolved
There was a problem hiding this 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.
b68b62d to
abba36e
Compare
There was a problem hiding this 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.
.../EFCore.Relational.Specification.Tests/Query/AdHocAdvancedMappingsQueryRelationalTestBase.cs
Show resolved
Hide resolved
test/EFCore.Tests/Metadata/Internal/InternalEntityTypeBuilderTest.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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
a714ed7 to
272ebfd
Compare
@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