Skip to content
0:00 / 0:00

#dependencyinjection#asp.netcore#csharp

How Dependency Injection Works in #csharp

Raw Coding

77K subscribers • 5 videos on Hallway

YouTube

Intermediate. Assumes working knowledge.

60K views6 years ago2 recommendations

Software designProgramming languagesDesign patternsC# and .NET

An explanation of dependency injection in C# by building a custom DI container with singleton and transient lifetimes.

In this dependency injection c# tutorial I answer the questions: what is dependency injection? how does dependency injection work? how do dependency injection lifetimes work? We implement our own dependency injection container and a resolver (which really could just be one object) with singleton and transient lifetimes for our dependencies. Primarily we are trying to understand that we want to know about all possible dependencies, so when we try to use a service we can assemble it automatically, and all services come from one source. Patreon 🤝 patreon.com/raw_coding Courses 📚 learning.raw-coding.dev Shop 🛒 shop.raw-coding.dev Discord 💬 discord.gg/xgNS26k Twitter 📣 twitter.com/anton_t0shik Twitch 🎥 twitch.tv/raw_coding 👉 Try Rider jetbrains.com/store/redeem/ RD5K9-4TXXW-KMV3G-NYWSF-3ZSTP LINQPad: linqpad.net/ Source: github.com/T0shik/raw-coding-101-tutorials/tree/master/Depen… #csharp #dotnet

Why it's here

2 people recommend this

What people say. Recommended for understanding the inner workings of dependency injection containers in .NET.

u/spurius_tadiusin r/dotnet • Recommends

On “How does .net core dependency injection work”

There’s a really nice video from “raw coding” that goes through building a primitive DI container in .net (link below). It’s helpful for understanding what goes on behind the scenes even if it’s not exactly how Microsoft’s framework is implemented. The concepts aren’t too hard but DI containers are often bewildering because there’s a lot of stuff that occurs “by convention” and not easy to infer what’s happening unless you’ve been using these a lot. link to this video

u/eneajahoin r/dotnet • Recommends

On “ELI5 the idea of registering my services in dependency injections containers”

After watching this: link to this video all these things made sense for me. Highly recommend it.