Wiring
Page 5 of 8 · Your questions

Your six questions, answered on alcohol.zinc

Keep the snapshot, still one DbContext, one migration gap to close in CI, and Bun has one plug-in system.

“Do we need snapshot files for .NET?”

Yes, while we use EF migrations; keep it and add one guide line

The short answer comes first, as a card:

Yes

Keep the snapshot

EF compares the code with the snapshot to write the next migration. With the snapshot deleted, a new migration tried to create all 33 tables again.
Measured

It is one file per app, written by EF, never by hand, and in alcohol.zinc's history it never clashed Measured.

The ways to live without it, priced on alcohol.zinc's 15 migrations:

Ways around the snapshot
WayOne-time costCost on every changeTag
Keep it, re-add a migration on a clashnoneone command, only on a clashmeasured
Hand-written SQL files (our Bun and Go way)export 727 lines of SQL, write a runnerevery schema change by handreasoned
Another tool (DbUp, FluentMigrator, Atlas)as SQL files, plus a dependencydepends on the toolnot tested
A git merge driver that rebuilds the snapshotwrite it, install it everywherea build inside every mergenot tested
Keep both sides on a clash (merge=union)one .gitattributes linecan produce broken codemeasured

Only the first row is cheap and measured. With SQL files, nothing writes the next change for you, and the model and the SQL can drift apart silently; 4 of the 15 migrations already hold hand SQL. Decide thisQ2What do we do about the .NET snapshot?

“Does it mean we still use one single DB context?”

Yes: still exactly one DbContext, one database, one snapshot

The answer card:

Yes

Still one MainDbContext

One database, one migrations folder, one snapshot. Only its list of tables and their details move into each module's own tables file.
Measured

The shared file goes from 343 lines to 30 and names no module; the snapshot stayed byte-for-byte the same Measured.

You also asked, earlier in the same thread: "dont we just have 1 dbcontext, and everything is registered there? can't we just make that part dynamic?" Yes, and that is what this is: it is done at build time by the compiler, not by searching at run time.

“What's the problem with migration?”

Of three problems you heard about, one is left, and it is small

You heard three different things; this is where each one stands:

The three migration problems
ProblemStatusWhy
One DbContext per moduledroppedit caused 5 problems; one shared DbContext has none
The snapshot can clashstays, smallone file, a one-command fix
A forgotten migration goes unnoticedtrue today, not caused by wiringfix: one CI line

The third one is real in alcohol.zinc today Measured:

  • A column was added without a migration. CI's tests passed, 158 of 158, because they build tables from the model.
  • The migrator said "Successfully migrated" and the app started. The column did not exist, and a query that used it failed.
  • alcohol.zinc is on EF Core 8, which does not check for model changes when it migrates. EF 9 and later refuse instead From docs.
“Does Bun have a plug-in system during tests and development or run? During build?”

Yes, one plug-in system for run, test, watch and the build API

A preload plug-in is a file Bun loads before your code; it can answer imports itself, for example serve the list of features.

The answer card:

Yes

One plug-in system for both

Bun's docs say "Bun has a universal plugin API that extends both the runtime and the bundler". On Bun 1.3.13, bun run and bun test see the feature list, and Bun.build with the plug-in builds an app that prints all features.
Measured

There is one gap Measured: the bun build command line cannot load a plug-in, and fails with Could not resolve: "virtual:features".

“Can you use the reference app alcohol.zinc to see how .NET works?”

Yes: everything in this report is alcohol.zinc, converted whole

The answer card:

Yes

The whole app, not a sample

23 modules, 33 tables and 67 service registrations, at commit 9fc729e, on its own pinned .NET 8 SDK and a real Postgres 17.
Measured

Every number on the earlier pages comes from that run.

“I thought you said it's shittier in .NET?”

That was true only for one DbContext per module, which is dropped

The answer card:

It depends

Worse only in the dropped design

With one DbContext per module, .NET was better than by hand in 5 cases and worse in 5. With one shared DbContext filled at build time, it is better in 4 of 12 cases and worse in none.
Measured

alcohol.zinc confirms the second result: same model, same tests, 2 fewer shared files per feature Measured.