Part of the EF Core migration generation epic — tracking issue #371.
De-risking spike for the whole epic: verify that a hand-written, attribute-only EF Core migration with no real EF model is a first-class citizen of the EF toolchain. Research strongly indicates yes (empty BuildTargetModel bodies are legal; the ModelSnapshot is design-time only; runtime discovery needs only the [DbContext] + [Migration] attributes), but this converts belief into verified fact before we build the generator.
What to build
A throwaway test project containing:
- A stub
DbContext (no entities) configured for Npgsql and SqlServer, with ConfigureWarnings(w => w.Ignore(RelationalEventId.PendingModelChangesWarning)) — required on EF Core 9+, which otherwise throws from Migrate() when the context model doesn't match the last migration.
- One or two hand-written
Migration subclasses carrying [DbContext]/[Migration("yyyyMMddHHmmss_Name")] attributes, with Up/Down bodies using MigrationBuilder calls (including raw store types via ColumnType) and a migrationBuilder.Sql(...) block.
Verify on both Npgsql and SqlServer EF providers (EF 9 and 10)
Stretch
- Check the SQLite EF provider: its ALTER-emulation (table rebuild) is the most model-hungry code path and may not tolerate an empty
TargetModel. Outcome decides whether SQLite is in or out for v1 of the generator.
The spike code does not need to merge; the deliverable is a written summary of results on this issue.
Part of the EF Core migration generation epic — tracking issue #371.
De-risking spike for the whole epic: verify that a hand-written, attribute-only EF Core migration with no real EF model is a first-class citizen of the EF toolchain. Research strongly indicates yes (empty
BuildTargetModelbodies are legal; theModelSnapshotis design-time only; runtime discovery needs only the[DbContext]+[Migration]attributes), but this converts belief into verified fact before we build the generator.What to build
A throwaway test project containing:
DbContext(no entities) configured for Npgsql and SqlServer, withConfigureWarnings(w => w.Ignore(RelationalEventId.PendingModelChangesWarning))— required on EF Core 9+, which otherwise throws fromMigrate()when the context model doesn't match the last migration.Migrationsubclasses carrying[DbContext]/[Migration("yyyyMMddHHmmss_Name")]attributes, withUp/Downbodies usingMigrationBuildercalls (including raw store types viaColumnType) and amigrationBuilder.Sql(...)block.Verify on both Npgsql and SqlServer EF providers (EF 9 and 10)
dotnet ef database updateapplies them and records__EFMigrationsHistoryrowsMigrate()/MigrateAsync()works (no pending-model-changes throw with the suppression in place)dotnet ef migrations script --idempotentproduces a correct scriptdotnet ef migrations bundle) workDown()/ migrating backwards worksStretch
TargetModel. Outcome decides whether SQLite is in or out for v1 of the generator.The spike code does not need to merge; the deliverable is a written summary of results on this issue.