๐ WAYPOINT LESSON
Checkpoint โ Modular Order Processing System
โญโญ intermediateโณ 25 min read๐ Lesson 122 of 265
The DI mini-build: order service with notification and audit, fakes in tests, singletons in the root.
The gate (mini-build)
Assemble the pieces into one composable order pipeline:
IOrderValidator.IsValid(decimal amount)โ business rule (amount > 0).IOrderRepository.Save(Order order)โ persistence boundary.IAuditLog.Record(string message)โ audit trail.OrderProcessor(IOrderValidator, IOrderRepository, IAuditLog)โ constructor-injected;Process(decimal amount)returns"ok:<id>"when valid (repository saves, audit records), else"rejected".BuildProcessor(IOrderRepository repo, IAuditLog audit)โ the composition root: registers a singleton validator and transient processor using the providedTinyContainer, resolves and returns the processor.
Order: record Order(int Id, decimal Amount). Repository generates ids
starting at 1.