Generated wiring, shown on the real alcohol.zinc
- What this is
- A test of generated wiring on the whole alcohol.zinc app - each feature brings its own wiring file and a build step writes the shared lists - with the before and after code, two exercises, and answers to your questions.
- Why it exists
- Can each feature register itself, so nobody edits the shared start-up lists again, and what does that cost in .NET, Bun, Go and Flutter?
- Length
- 8 short pages; the last one is where you decide.
Each feature can wire itself, and alcohol.zinc behaves exactly the same
Today alcohol.zinc lists every feature by hand in a few shared lists. A shared file is a file that every new feature has to edit, such as the list of tables.
With generated wiring, each feature brings its own small wiring file in its own folder. A build step reads those files and writes the lists as plain code. Nobody edits the shared lists again.
We converted the whole app, not a sample: 23 modules, 33 tables and 67 service registrations Measured. The numbers below are the result.
The one shared file left is written by Entity Framework (EF) itself, so a person edits none.
Same build, same tests, same database, same deploy
Each check ran on the original copy and on the converted copy:
| Check | Original | Converted |
|---|---|---|
| Build errors and warnings | 0 and 57 | 0 and 57 |
| Unit tests passed | 320 of 330 | 320 of 330 |
| Integration tests passed | 158 of 158 | 158 of 158 |
| App start on a fresh database | starts, migrates | starts, migrates |
| Tables in that database | 34 | the same 34 |
All of it is measured Measured. The same 9 unit tests fail on both copies, because they need an email-template install that was skipped.
- The app was started in Development mode, where .NET checks every registration when the app is built From docs. Both copies start with 0 errors.
- A migration is a C# file that changes the database; EF writes it on request. The deploy-time program that applies them still applies all 15 to a fresh database.
One piece we own per template, and in .NET and Bun nothing to remember
Each language gets one piece of tooling; the right column is what a developer has to remember.
| Language | What we ship | What to remember |
|---|---|---|
| .NET | a source generator, 251 lines | nothing; on a snapshot clash, one command |
| Bun | a preload plug-in, about 100 lines | nothing for run, test and watch |
| Go | a generator run by go generate | run go generate after adding a feature |
| Flutter | a build_runner builder | run build_runner on a fresh clone |
The snapshot is one file, written by EF, that records the whole database after the last migration. It is the one shared file left in .NET.
The .NET row is measured on alcohol.zinc; Go, Bun and Flutter were measured in earlier tests Measured. The per-language page has the details.
The gain is nothing to forget, more than fewer merge conflicts
The shared files were edited by 25 of 64 pull requests, but clashed in only 2 of 94 merges. Measured
- So generated wiring mostly removes edits to shared files and the chance to forget one.
- It removes few real merge conflicts, because there were few.
- Its costs: one file we own per template; in .NET the snapshot can still clash; and Bun's release build needs a 20-line build script.
Three things are not tested, and five questions wait for you
These three are open, and none of them is about behaviour:
- Windows, in any language: it needs spend
- Clicking through a real editor window (VS Code, Rider)
- Building the converted app's Docker image, and a real CI run
None of them can change the results above. The questions are on the Decide page, each with a recommendation. Decide thisQ1Do the templates get generated wiring?
- Today alcohol.zinc lists every feature by hand in shared start-up files, so every new feature edits them.
- With generated wiring, each feature brings its own small wiring file, and the build writes the shared lists as plain code.
- We converted the whole app - 23 modules, 33 tables, 67 service registrations - not a sample.
- It builds with the same 57 warnings, passes the same tests, and the data model did not change by one byte.
- A new feature with a table now edits 1 shared file instead of 3, and that one file is written by EF, not by a person.
- In two merge exercises the hand-edited lists caused every clash but the snapshot; generated wiring removes them.
- In the real history these files clashed in only 2 of 94 merges, so the gain is mostly "nothing to remember", not fewer conflicts.
- Each template gets one piece we own - a source generator, a Bun plug-in, a Go generator or a Flutter builder.
- Separately, alcohol.zinc's CI misses a forgotten migration today; one CI line fixes it.
- Five questions wait for you on the last page.