Add note about EF Core 9 PendingModelChangesWarning behavior in managing.md#5402
Open
sayinbrahim wants to merge 1 commit into
Open
Add note about EF Core 9 PendingModelChangesWarning behavior in managing.md#5402sayinbrahim wants to merge 1 commit into
sayinbrahim wants to merge 1 commit into
Conversation
Cross-references the new EF Core 9 runtime behavior (where Migrate() throws an exception when pending changes exist) from the "Checking for pending model changes" section. This complements PR dotnet#5390 which added a note in applying.md, completing the cross-page documentation flow.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds documentation to help readers of the migrations management page understand EF Core 9’s new runtime behavior around pending model changes, complementing the existing note added in applying.md (from #5390).
Changes:
- Added a new
[!NOTE]under “Checking for pending model changes” explaining EF Core 9’s automatic exception behavior when callingMigrate()/MigrateAsync()with pending model changes. - Added cross-references to the “Apply migrations at runtime” section and the EF Core 9 breaking changes entry for this behavior.
| You can also perform this check programmatically using `context.Database.HasPendingModelChanges()`. This can be used to write a unit test that fails when you forget to add a migration. | ||
|
|
||
| > [!NOTE] | ||
| > Starting with EF Core 9, an exception is thrown automatically when `Migrate()` or `MigrateAsync()` is called with pending model changes (warning event ID `RelationalEventId.PendingModelChangesWarning`). See the [applying migrations documentation](xref:core/managing-schemas/migrations/applying#apply-migrations-at-runtime) and the [breaking change note](xref:core/what-is-new/ef-core-9.0/breaking-changes#pending-model-changes) for more information. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Complements PR #5390 by adding the inverse cross-reference: while #5390 added a note in
applying.mdabout the EF Core 9PendingModelChangesWarningexception behavior, themanaging.mdpage (which documents thehas-pending-model-changescommand) doesn't mention that this check is now performed automatically at runtime in EF Core 9.Changes
managing.md, after the existing programmatic check descriptionapplying.md#apply-migrations-at-runtimeand the EF Core 9 breaking change pageWhy this matters
A developer reading
managing.mdlearns abouthas-pending-model-changesas a check command but doesn't discover that EF Core 9 now performs this check automatically whenMigrate()is called. The inverse direction (applying.md → managing.md) was addressed in #5390; this PR completes the bidirectional cross-reference.Related
applying.md