Built-in DI container — service lifetimes, registration patterns, and testing with mocks.
Five passes over the same idea, each from a different angle. Do them in order, or jump to whichever you need.
.NET's built-in DI container manages service lifetimes: Transient, Scoped, and Singleton. Key concepts: constructor injection, IServiceCollection registration, service resolution, keyed services (.NET 8+), and integration with middleware/controllers. DI enables testable, loosely-coupled architectures.