Dependency Injection Deep Dive | .NET & C# Essentials

  Рет қаралды 15,565

Amichai Mantinband

Amichai Mantinband

Күн бұрын

In today's video we'll dive into Dependency Injection in .NET & ASP.NET.
We'll cover almost everything you need to know about integrating dependency injection in your applications from the various lifetimes to every single configuration method on the dependency injection Inversion of Control (IoC) container.
Connect with me on 'em socials:
Twitter: / amantinband
LinkedIn: / amantinband
GitHub: github.com/amantinband
Check out all my courses on DomeTrain:
dometrain.com/author/amichai-...
Support the channel and get the source code:
/ amantinband
Thanks for watching, don't forget to like & comment & subscribe! ❤️ 💻
0:00. Opening
0:59. Registering controllers
2:43. Registering services
7:18. Implementing what ASP.NET does using the IServiceCollection and the ServiceProvider
09:10. Transient lifetime
11:21. Singleton lifetime
18:38. Scoped lifetime
27:35. Multiple Registrations
30:16. Keyed services
32:44. TryAdd methods
34:20. Service descriptor and the Add method
35:20. TryAddEnumerable

Пікірлер: 40
@amantinband
@amantinband 2 ай бұрын
Cheers 🥂 0:00. Opening 0:59. Registering controllers 2:43. Registering services 7:18. Implementing what ASP.NET does using the IServiceCollection and the ServiceProvider 09:10. Transient lifetime 11:21. Singleton lifetime 18:38. Scoped lifetime 27:35. Multiple Registrations 30:16. Keyed services 32:44. TryAdd methods 34:20. Service descriptor and the Add method 35:20. TryAddEnumerable
@voidmice1669
@voidmice1669 2 ай бұрын
Finally cleared out for me the difference between AddScoped and AddTransient. Thanks! 😊
@lucaciandrei
@lucaciandrei 18 күн бұрын
very clear and concise explanations, congrats and to many more tutorials
@martinlabastie3518
@martinlabastie3518 2 ай бұрын
This sereies is amazing, please never stop
@shahzadahmad-vg2ou
@shahzadahmad-vg2ou Ай бұрын
Absolutely fantastic tutorial! The depth of explanation is unparalleled. Keep up the great work!
@user-dg5qy3cq8m
@user-dg5qy3cq8m 2 ай бұрын
In my opinion the best tutor for explaining complex topics in easy steps without skipping important details
@HackerUC
@HackerUC Ай бұрын
Best explanation I've heard on DI. 👍🏼
@sushilb7994
@sushilb7994 2 ай бұрын
Yet another wonderful video from Amichai ❤ thank you…
@EzequielBinker
@EzequielBinker 2 ай бұрын
Excellent video Amichai. You're great!!
@longuinni
@longuinni 2 ай бұрын
Really nice introtuction to DI.
@greekplayback
@greekplayback 2 ай бұрын
תודה אלוף
@mckayanderson2046
@mckayanderson2046 15 күн бұрын
So good Amichai! I'll be purchasing your courses and recommending to friends. Have you dug into Microsoft's Semantic Kernel yet? The documentation and current tutorials from the team are really scattered and confusing and I didn't find a single good example of applying good DDD and Clean Architecture. I won't need it by the time you're done, but it might be a good opportunity for you.
@naftalyweinberger7892
@naftalyweinberger7892 Ай бұрын
thanks amichai, i like when u talk fast, its more easy.
@aldkdenedik2451
@aldkdenedik2451 2 ай бұрын
Really nice
@vascofernandes6192
@vascofernandes6192 2 ай бұрын
Fantastic video
@Andy01010
@Andy01010 2 ай бұрын
Great stuff, tbh you have a good chance to lead the c# and .net learning for us mortals. The more people understand it the more it is used
@Philippe42460
@Philippe42460 2 ай бұрын
Hi Amichai, Thank you very much for this very good introduction to service registration, this will be very useful for my new colleagues. 👍
@neroamayo6345
@neroamayo6345 2 ай бұрын
Great content. Please keep it up.😇😇
@joshmeyers2034
@joshmeyers2034 Ай бұрын
I always share your videos with my team. So detailed and easy to digest. What kind of annotating tool do you use? I can't find anything remotely like it other than zoomit 🙂
@gerardwisse406
@gerardwisse406 2 ай бұрын
Another great video. Thx for sharing and keep up the good work. And just out of curiosity, what tool do u use to draw those colorful arrows and rectangles?
@DavidSmith-ef4eh
@DavidSmith-ef4eh Ай бұрын
I wish we had such things in PHP. In php di system, everything is just a singleton, had to create my own DI service to be able to have factories/transient services. Maybe in 20 years, php will catch up to this.
@shayvt
@shayvt 2 ай бұрын
Thank you Amichai for another great video. Regarding keyed services - is it ok to use it or is it a code smell? When I have more than one implementation, I usually create a factory class, register the factory and the implementations in the container, get the IEnumerable to the factory, and use the factory to pick the implementation. What do you think? Another thing - do you know if there is an option to register all the implementations of an interface from an assembly? I saw it in other container and I think it could be very useful. תודה 🙂
@allwinantofranklin895
@allwinantofranklin895 7 күн бұрын
Can you share how to implement DI in .NET Framework. It will be very useful for lot of Company who are struck with Framework. I think with using DI in Framework we can refactor the code to match .NET Core style and make the migration process easy... What is your opinion in this?
@alexandernava9275
@alexandernava9275 Ай бұрын
I am confused on the lifetime of a single request for scoped. What is that? Like is there a timeout for each "session" on a browser?
@ivandrofly
@ivandrofly 20 күн бұрын
What is the name of the tool that you are using for highlighting and creating arrows? PS: I've been using ZoomIt from Microsoft Sysinternals
@seba123321
@seba123321 2 ай бұрын
Can you recommend a solution/library/helper for scenario where you have a lot of classes and corresponding interfaces. Scan of dlls and bulk registration. Registration by conversion: IService1 and Service1. I'm sure that there must be an easy way to do that.
@amantinband
@amantinband 2 ай бұрын
I have a video in my backlog on dynamic DI registration using a few different NuGet packages
@thijsvandervegt3377
@thijsvandervegt3377 2 ай бұрын
Hey Amichai 👋 , any chance you're making a Deep Dive course on DDD on Dometrain sometime soon?
@amantinband
@amantinband 2 ай бұрын
Working on it as we speak 💪🏼
@maheshgangineni4860
@maheshgangineni4860 2 ай бұрын
Nice video , can you share the extensions that you use for dotnet development?
@amantinband
@amantinband 2 ай бұрын
This is pretty similar to what I’m using today: kzbin.info/www/bejne/o2qrp6Z4ZpKbd9Esi=TKZqbOSktM_Y5FHl
@az6876
@az6876 2 ай бұрын
This video can be defined as a reference to definitively understand dependency injection in c#. Can I ask you what you think about the class constructor in C# defined like this: public class NumbersController(NumberService numberService) { private readonly NumberService numberService = numberService; // also I can add ?? throw new ArgumentNull... ... } Thanks
@amantinband
@amantinband 2 ай бұрын
Looks good, but the exception throwing is redundant since the DI container with throw an exception if it cannot resolve a dependency
@az6876
@az6876 2 ай бұрын
@@amantinband Thank you
@parkerwarner8688
@parkerwarner8688 2 ай бұрын
Are keyed services essentially an implementation of the factory pattern or am I misunderstanding that?
@amantinband
@amantinband 2 ай бұрын
Not exactly
@parkerwarner8688
@parkerwarner8688 2 ай бұрын
@@amantinband would love to hear more, thanks!
@shayvt
@shayvt 2 ай бұрын
Do you prefer vscode over vs or rider?
@amantinband
@amantinband 2 ай бұрын
Yep
Making LINQ Blazing fast with PLINQ (Parallel LINQ) | .NET & C# Essentials
36:26
REST API Design Best Practices
18:57
Amichai Mantinband
Рет қаралды 551
Glow Stick Secret (part 2) 😱 #shorts
00:33
Mr DegrEE
Рет қаралды 49 МЛН
Не пей газировку у мамы в машине
00:28
Даша Боровик
Рет қаралды 9 МЛН
Swagger is Going Away in .NET 9!
10:48
Nick Chapsas
Рет қаралды 63 М.
Dependency Injection & Inversion of Control
11:00
Ryan Schachte
Рет қаралды 190 М.
Exceptions are evil. This is what I do instead.
24:41
Amichai Mantinband
Рет қаралды 15 М.
Every Single LINQ Extension Method With Examples | .NET & C# Essentials
42:28
Clean Architecture vs Domain-Driven Design (DDD) - Understand the Difference
11:26
Stop Calling Your API a "REST API"
17:42
Amichai Mantinband
Рет қаралды 11 М.
Winglang in 10 minutes
11:39
Amichai Mantinband
Рет қаралды 9 М.
Understand Clean Architecture in 7 Minutes
7:02
Amichai Mantinband
Рет қаралды 74 М.
Why Developers Are OBSESSED With Obsidian
11:26
Amichai Mantinband
Рет қаралды 29 М.
How Neuralink Works 🧠
0:28
Zack D. Films
Рет қаралды 30 МЛН
Fiber kablo
0:15
Elektrik-Elektronik
Рет қаралды 6 МЛН
Купите ЭТОТ БЮДЖЕТНИК вместо флагманов от Samsung, Xiaomi и Apple!
13:03
Thebox - о технике и гаджетах
Рет қаралды 79 М.
The power button can never be pressed!!
0:57
Maker Y
Рет қаралды 46 МЛН
Which Phone Unlock Code Will You Choose? 🤔️
0:14
Game9bit
Рет қаралды 9 МЛН