One folder, one bounded contextLLM view

.NET

Possible, and the biggest change of the four. The layer projects and the solution file go. Each context becomes its own project.

The files

Explorer
  • all.projfinds projects by pattern; no solution file
  • Kernel.csprojthe app
  • what every context may use
  • the layer check, runs in the build
  • Directory.Build.propsnames and references come from the folder
  • context.yaml
  • orders.Contract.csproj
  • orders.csprojone line
  • Context.csthe one registration
  • policies.yaml
  • flags.yaml

The boundaries hold

planted breaches (real output, shortened)
$dotnet build contexts/billing/src/billing.csproj
error CS0234: The type or namespace name 'Orders' does not exist in the namespace 'Ctx' (are you missing an assembly reference?)
$
1 / 2

.NET in detail, on real alcohol.zinc

Two modules were moved into their own projects: Causes (a leaf) and NfcTag (tangled). MEASURED

CheckResult
Build0 errors
Unit teststhe same 333 names; the same 9 that failed before still fail
Database modelbyte-identical SQL; no pending migration
Files164 touched: 109 pure moves, 55 changed
Generated registrationno reflection scan
Clean build before the move18 to 22 s
Clean build after the move33 s
  • The pain is the real app, not the template. In the code, 19 of 23 modules form one loop (this scan folds HabitVersion and HabitExecution into Habit); .NET refuses loops between projects. The shared DbContext is used 506 times in 35 files. MEASURED
  • Your model costs build time: 25 contexts as projects build in 77 seconds from clean, against 13 seconds as one project. One edit costs about the same (10 against 9 seconds). MEASURED
  • I keep projects. They are your model, and they are what makes the compiler guard each context. Caching and testing only the changed context should win most of it back. REASONED, NOT TESTED
  • Moving all of zinc: 1 to 2 weeks, mostly untangling the loop. REASONED

Database models split across projects (EF)

QuestionOne DbContextOne DbContext per context
Model split across projectsworksworks
Migrations on real Postgresworkwork
Two pull requests add neighbouring tablesconflict in the shared snapshotclean
A transaction across contextsworksneeds a shared connection
A database link across contextsworksraw SQL only, invisible to EF

MEASURED. The design forbids the last two anyway. This is trade-off 2.