Dependency Injection Deep Dive | .NET & C# Essentials

preview_player
Показать описание
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: 

Check out all my courses on DomeTrain: 

Support the channel and get the source code:

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
Рекомендации по теме
Комментарии
Автор

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

amantinband
Автор

Finally cleared out for me the difference between AddScoped and AddTransient. Thanks! 😊

voidmice
Автор

This sereies is amazing, please never stop

martinlabastie
Автор

Absolutely fantastic tutorial! The depth of explanation is unparalleled. Keep up the great work!

shahzadahmad-vgou
Автор

Yet another wonderful video from Amichai ❤ thank you…

sushilb
Автор

Excellent video Amichai. You're great!!

EzequielBinker
Автор

Best explanation I've heard on DI. 👍🏼

HackerUC
Автор

very clear and concise explanations, congrats and to many more tutorials

lucaciandrei
Автор

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

Andy
Автор

Hi Amichai,
Thank you very much for this very good introduction to service registration, this will be very useful for my new colleagues. 👍

Philippe
Автор

thanks amichai, i like when u talk fast, its more easy.

naftalyweinberger
Автор

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.

DavidSmith-efeh
Автор

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.

mckayanderson
Автор

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?

gerardwisse
Автор

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.

תודה 🙂

shayvt
Автор

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 🙂

joshmeyers
Автор

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?

alexandernava
Автор

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

ivandrofly
Автор

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.

seba
Автор

Nice video, can you share the extensions that you use for dotnet development?

iammahie