Skip to content

Spike B: design time without .targets, from a packed consumer #17

Closed

Description

@CaffeinatedCoder

Result, 2026-11-11: passed, in #39. 62 paths as expected on SQLite, Npgsql and SQL Server (EF Core 11.0.0-rc.3, dotnet-ef 11.0.0-rc.3), from a package with no build/ folder and a consumer outside the repository. No .targets, and no fallback attribute.

Path SQLite Npgsql SQL Server
migrations add: the migration creates the declared index ok, with a constructor, a factory and a host ok ok
has-pending-model-changes, nothing changed / a kit-only change no changes / reported same same
migrations add for the kit-only change Up creates the one index, Down drops it same same
migrations script, applied to an empty database both indexes both indexes text only
migrations script --idempotent, applied twice refused by the provider both indexes text only
GenerateCreateScript() both indexes both indexes both indexes
EnsureCreated(), Migrate(), database update, a bundle executed both indexes both indexes not run
Migrate() with a pending kit-only change refused: PendingModelChangesWarning refused not run
dbcontext optimize, then EnsureCreated() on the compiled model both indexes both indexes not run
The kit left out Outcome
No UseSchemaKit(), or a design-time factory that forgets it migrations add is refused at the declaration; nothing is written
A compiled model without it, EnsureCreated() and Migrate() Loud: EF builds the design-time model from OnModelCreating
The user's own IDesignTimeServices registers a differ Silent: the migration scaffolds without the index and the snapshot hides it. The known residual, and the control for the content checks

Found on the way: a statement without the provider's terminator passes migrations add, database update, a bundle and Migrate(), and the generated scripts do not apply. The rows that apply the scripts were added for it. The "it fails when" below did not happen.


Kills the delivery if it fails (plan, section 6).

Question

With no DesignTimeServicesReferenceAttribute and no .targets, does every design-time path get the context's own differ? EF Core v11.0.0 seeds the design-time collection with TryAdd(_ => context.GetService<IMigrationsModelDiffer>()) before anything else (DesignTimeServicesBuilder.cs:59). That is read from source, not run.

Conditions

A consumer project outside the repository, restoring a packed spike build through a private package cache and source mapping, as the 5.x smoke test does. Paths: migrations add, migrations has-pending-model-changes, migrations script, migrations script --idempotent, migrations bundle, dbcontext optimize, EnsureCreated(), GenerateCreateScript(), Migrate(). With an IDesignTimeDbContextFactory and without one.

It fails when

Any path does not see a declared object, without an error. Then a ForProvider attribute installs the same decorator, and the smoke test keeps its 5.x job.

Done when

The table of paths is in this issue, each asserted on scaffolded content, never on the exit code.

Activity

  1. added this to the 11.0.0 milestone on Nov 11, 2026
  2. added
    tests
    package/core
    area/migrations
    area/release
    on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/migrationsarea/releasepackage/coretests

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions