When a host ASP.NET Core application references plugin assemblies, EF Core's automatic entity discovery can pull plugin-owned tables into the host's migration timeline. This happens via navigation property traversal, explicit modelBuilder.Entity<T>() calls, or ApplyConfigurationsFromAssembly scanning plugin assemblies. The result is three concrete failure modes: duplicate schema creation when both host and plugin migrations try to create the same table, schema drift as the two migration histories diverge, and orphaned migration history that makes plugin uninstallation dangerous. The model snapshot compounds the problem — once a plugin entity enters the snapshot, simply removing the DbSet property triggers a DROP TABLE on the next migration. Quick fixes like Ignore<T>() or [NotMapped] eliminate EF Core's ability to query the entity, while HasNoKey().ToView() is semantically incorrect. The correct solution — ExcludeFromMigrations() — is previewed as the subject of Part 2.

8m read timeFrom daily-devops.net
Post cover image
Table of contents
How EF Core Discovers EntitiesThe Three Failure ModesA Concrete Look at the Bad MigrationThe Model Snapshot TrapWhy the Obvious Fixes Fall Short
60.6K Impressions1 Comment