Skip to content

Throw when IsExcludedFromMigrations is executed on the runtime model#37869

Merged
roji merged 1 commit intodotnet:mainfrom
roji:Leftovers
Mar 6, 2026
Merged

Throw when IsExcludedFromMigrations is executed on the runtime model#37869
roji merged 1 commit intodotnet:mainfrom
roji:Leftovers

Conversation

@roji
Copy link
Copy Markdown
Member

@roji roji commented Mar 6, 2026

Leftover from #37815

Copy link
Copy Markdown

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

Updates EF Core relational metadata behavior to prevent accessing migrations-only foreign key metadata on a compiled/runtime model, aligning with the existing “runtime model missing data” pattern used across other relational extensions.

Changes:

  • Make RelationalForeignKeyExtensions.IsExcludedFromMigrations(IReadOnlyForeignKey) throw InvalidOperationException(CoreStrings.RuntimeModelMissingData) when invoked on a RuntimeForeignKey.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/EFCore.Relational/Extensions/RelationalForeignKeyExtensions.cs
@roji roji enabled auto-merge (squash) March 6, 2026 11:21
@roji roji merged commit 94f0b72 into dotnet:main Mar 6, 2026
10 checks passed
@roji roji deleted the Leftovers branch March 6, 2026 15:40
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.

3 participants