Most developers use Dependency Injection.
Very few understand what the DI container is actually doing.
To many people, it feels like magic.
You register a few services:
builder. Services.AddScoped<IOrderService, OrderService>();
builder. Services.AddScoped<IOrderRepository, OrderRepository>();
Then suddenly this works:
public class OrdersController(IOrderService service)
No new keyword.
No wiring dependencies.
And the application runs.
So whatโs actually happening?
When ASP. NET Core starts, the DI container builds a service registry.
A map that says:
IOrderService โ OrderService
IOrderRepository โ OrderRepository
Later, when the framework needs to create your controller, it asks the container:
โHow do I build this object?โ
The container looks at the constructor:
OrdersController(IOrderService service)
It sees that IOrderService is required.
So it resolves it.
But to build OrderService, it might need something else:
OrderService(IOrderRepository repo)
So the container resolves that too.
And maybe the repository needs a database context.
So the container resolves that as well.
What you end up with is something called an object graph:
Controller
โ
Service
โ
Repository
โ
DbContext
You requested one object.
The container constructed the entire dependency tree.
Thatโs the real job of the DI container.
Not โinjecting servicesโ.
But building object graphs safely and consistently.
Which is why DI becomes powerful when your system grows.
Because instead of every class creating its own dependenciesโฆ
The container becomes the single place responsible for object creation.
And that gives you:
โข cleaner architecture
โข predictable lifetimes
โข easier testing
โข fewer hidden dependencies
The moment this clicks, DI stops feeling like magic.
It starts feeling like infrastructure.
Curious:
What part of Dependency Injection confused you the most at first?
__
๐ Don't miss the next newsletter issue, 20,000 engineers will read it, join them: https://t.co/gI46R2Kc0c
๐ Join our Free Closed .NET Hub (1.2k members) and get access to content nobody publicly has: https://t.co/IPQwbeQ8pG
โป๏ธ Repost to others.
๐ You can save this post for later, and you should do it.
โ Follow me to learn #Dotnet and Architecture every day.
๐ญ๐ฌ years in .NET.
If I had to start again today, from zero, this is exactly what I would do.
๐ญ. I would master debugging before mastering design patterns.
๐ฎ. I would learn how HTTP actually works.
๐ฏ. I would deeply understand async/await.
๐ฐ. I would learn how memory works in .NET (GC, allocations).
๐ฑ. I would build one ugly but working CRUD app.
๐ฒ. I would deploy something in the first 30 days.
๐ณ. I would learn Git properly (rebase, squash, cherry-pick).
๐ด. I would read existing production code daily.
๐ต. I would study logging and observability early.
๐ญ๐ฌ. I would learn how to write meaningful commit messages.
๐ญ๐ญ. I would focus on architecture after building real apps - not before.
๐ญ๐ฎ. I would learn SQL seriously, not just EF Core.
๐ญ๐ฏ. I would understand transactions and isolation levels.
๐ญ๐ฐ. I would practice writing tests that actually fail.
๐ญ๐ฑ. I would learn to read stack traces fluently.
๐ญ๐ฒ. I would learn Docker basics in year one.
๐ญ๐ณ. I would understand dependency injection internally, not just use it.
๐ญ๐ด. I would measure performance before optimizing anything.
๐ญ๐ต. I would avoid microservices until I truly need them.
๐ฎ๐ฌ. I would build at least one API from scratch without templates.
๐ฎ๐ญ. I would learn how authentication and authorization really work.
๐ฎ๐ฎ. I would understand what happens when production crashes.
๐ฎ๐ฏ. I would study real post-mortems of outages.
๐ฎ๐ฐ. I would learn how to review code properly.
๐ฎ๐ฑ. I would keep pull requests small.
๐ฎ๐ฒ. I would learn to communicate technical trade-offs clearly.
๐ฎ๐ณ. I would avoid copying architectures from YouTube.
๐ฎ๐ด. I would understand threading before touching parallelism.
๐ฎ๐ต. I would learn to read documentation, not just tutorials.
๐ฏ๐ฌ. I would build side projects that solve real problems.
๐ฏ๐ญ. I would learn CI/CD in year one.
๐ฏ๐ฎ. I would understand how APIs fail and design for failure.
๐ฏ๐ฏ. I would study security basics early (OWASP, input validation).
๐ฏ๐ฐ. I would seek feedback aggressively.
๐ฏ๐ฑ. I would focus on clarity over cleverness.
After 10 years, I donโt believe in โlearn everything.โ
I believe in mastering fundamentals deeply.
Frameworks change.
Principles donโt.
โ
Join 19,000+ engineers in the .NET Newsletter. You will learn .NET and Architecture every week directly from your email: https://t.co/gI46R2Kc0c
If you're starting today, focus on depth, not hype.
โป๏ธ Repost if this helps someone.
โ Follow for pragmatic #dotnet insights.