Code structure · demo 00 · 01
The direction of dependencies: layers or hexagon
The same bank, built in layers then as a hexagon. A request follows the same path in both; what turns around is the direction of the arrows between projects, and with it the cost of changing the storage.
Reduced motion: the scene is paused; use "Step" or "Play".
What to watch
- In layers, each project references the one below:
Layered.Businessdepends onLayered.Dataand handles itsAccountEntity. - In hexagonal,
Hexa.Hexagonreferences nobody: it declares its ports (IMakeTransfer,IAccounts…) and the adapters depend on it. The entry points (web, console) wire everything inProgram.cs. - Swap the storage in both modes: in layers, the business is touched; in hexagonal, only the persistence adapter changes, the hexagon stays intact. The path of the request does not change.