Skip to content

Add note about EF Core 9 PendingModelChangesWarning behavior in managing.md#5402

Open
sayinbrahim wants to merge 1 commit into
dotnet:mainfrom
sayinbrahim:patch-2
Open

Add note about EF Core 9 PendingModelChangesWarning behavior in managing.md#5402
sayinbrahim wants to merge 1 commit into
dotnet:mainfrom
sayinbrahim:patch-2

Conversation

@sayinbrahim

Copy link
Copy Markdown
Contributor

Summary

Complements PR #5390 by adding the inverse cross-reference: while #5390 added a note in applying.md about the EF Core 9 PendingModelChangesWarning exception behavior, the managing.md page (which documents the has-pending-model-changes command) doesn't mention that this check is now performed automatically at runtime in EF Core 9.

Changes

  • Added a note in the "Checking for pending model changes" section of managing.md, after the existing programmatic check description
  • Cross-linked to both applying.md#apply-migrations-at-runtime and the EF Core 9 breaking change page
  • Note format and xref syntax match PR Add note about PendingModelChangesWarning behavior in EF Core 9 #5390 conventions

Why this matters

A developer reading managing.md learns about has-pending-model-changes as a check command but doesn't discover that EF Core 9 now performs this check automatically when Migrate() is called. The inverse direction (applying.md → managing.md) was addressed in #5390; this PR completes the bidirectional cross-reference.

Related

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.

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

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 calling Migrate() / 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.
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.

2 participants