# Dependency Injection

Dependency Injection: What is a Dependency, Constructor Injection, Layers: Models, Services, Controllers.

Updated: November 3, 2026

1. [What is a Dependency](https://www.ask-codey.com/lessons/dependency-injection-what-is-a-dependency) (Apprentice): A dependency is an object a class needs to do its job. When a class creates its own dependencies with new, it's wired to them for good, and hard to test.
2. [Constructor Injection](https://www.ask-codey.com/lessons/dependency-injection-constructor-injection) (Journeyman): A class asks for its dependencies in its constructor and keeps them in readonly fields. Whoever creates it passes them in, so a test can pass a fake.
3. [Layers: Models, Services, Controllers](https://www.ask-codey.com/lessons/dependency-injection-layers-models-services-controllers) (Journeyman): Apps are split into layers (controllers, services, data access and models), each with one job, each handed the layer below it through its constructor.

Source: https://www.ask-codey.com/courses/csharp-full-stack-bootcamp/topics/dependency-injection
