Hi ASPNETZERO Team,
We are currently migrating our ASP.NET Zero application from version 13.3 to 14.0. As part of the upgrade, I’ve updated the following:
• Entity Framework Core: Upgraded from EF Core 8 to EF Core 9 • ABP Framework: Upgraded from ABP 9.x to ABP 10 • ASP.NET Zero: Upgraded from 13.3 to 14.0
Initially, we were using Abp.EntityFrameworkCore.EFPlus version 9.2.2. However, since EFPlus does not yet support EF Core 9, we attempted to comment out the EFPlus package and related usages.
After doing this, when we run the application using EF Core 9 + ABP 10 (no EFPlus), we encounter the following runtime exception:
InvalidOperationException: An error was generated for warning 'Microsoft.EntityFrameworkCore.Migrations.PendingModelChangesWarning': The model for context 'XXXDbContext' has pending changes. Add a new migration before updating the database.
The error originates from this line in MigrationHelper.cs: migrationHelper.PerformMigrationAndSeeding();
However, when we comment out EFPlus and downgrade back to EF Core 8 and ABP 9, the ASPNETZERO web portal runs without any issues.
Is this stricter behavior expected in ASP.NET Zero v14 with EF Core 9?
1 Answer(s)
-
0
Hi @vital
Starting with EF Core 9, the framework enforces a stricter model validation check during startup. If the runtime model differs from the last applied migration, EF Core throws PendingModelChangesWarning as an exception (previous versions only logged a warning).
When you removed EFPlus, the model snapshot changed, so EF Core now detects a mismatch and blocks the startup.
Create a new migration after removing EFPlus:
Add-Migration RemoveEfPlusDependencies Update-DatabaseEnsure your DbContextModelSnapshot is fully in sync with the new EF Core 9 model.
If you don’t plan to use EFPlus on EF Core 9, make sure all EFPlus dependent configuration is removed.
We believe the application will launch normally after adding the new migration. Could you please let us know if the issue is resolved after applying this change?
Thank you.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)