
.NET Core has a built-in dependency injection (DI) container used to wire up services at startup.
Composition root: The place where object graphs are composed — typically Program.cs / Startup.
builder.Services.AddScoped<IOrderRepository, OrderRepository>(); builder.Services.AddScoped<IEmailSender, SmtpEmailSender>();
Lifetimes: Singleton, Scoped, Transient — choose based on state and thread-safety.
Architecture impact: Proper DI usage enforces boundaries, enables testing, and keeps infrastructure swappable.
Reference:
TaskLoco™ — The Sticky Note GOAT