Skip to content
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

PendingModelChangesWarning when migrating from .NET 8 to .NET 9 with multitenancy per schema #35182

Closed
dziedrius opened this issue Nov 22, 2024 · 2 comments

Comments

@dziedrius
Copy link

There are several issues reported related to PendingModelChangesWarning, but our case is quite unique, hence I've decided to open separate issue.
I did quite isolated repro: https://github.com/dziedrius/migration-efcore-9-issue (it is in .NET 8 currently, so that it would be possible to see how behavior changes after migrating to .NET 9)

What I was able to figure out:
So as long as EF Core does not support multitenancy per schema (kind of sad, as in my opinion that is one of the clearest way to do multitenancy), we did it ourselves, it needed custom code, but kind of manageable (strongly influenced by https://github.com/Oriflame/EFCoreMultitenantSample).

The problem is, that schema is applied to migration operations just during runtime, meaning that when migrator is checking diff for source/target models, it sees different schema and hence throws the exception, seems that this check was introduced in .NET 9.

I could not figure out how I could get better control over this, so used the only workaround I knew - disabled warning, and not sure if that is a good way to approach - as I'm loosing ability to get a warning when real model mismatches will appear.

Include provider and version information

EF Core version:
Database provider: (e.g. Npgsql.EntityFrameworkCore.PostgreSQL)
Target framework: (e.g. .NET 9.0)

@cincuranet
Copy link
Contributor

Dupe of #35158.

@cincuranet cincuranet closed this as not planned Won't fix, can't repro, duplicate, stale Nov 22, 2024
@AndriySvyryd
Copy link
Member

Disabling the warning is the correct approach in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants