Trying to create a Dependency Injection/IoC Container FROM SCRATCH

  Рет қаралды 47,658

Nick Chapsas

Nick Chapsas

Күн бұрын

Пікірлер: 50
@ikroeber
@ikroeber 8 ай бұрын
This was really awesome to watch. About the actual performance of instantiating via the Activator, you can also register the implementation via expressions to make it run faster.
@kxpes
@kxpes Жыл бұрын
I really love the approach, if we had to, this is exacly way we would had to do dependency injection at university. To understand this, but it is beautiful to see functionality made from scratch to more or less see what internals are doing.
@kopilkaiser8991
@kopilkaiser8991 Жыл бұрын
It was a bit complicated to keep up. Your modules which you discuss are high level and the reason it gets difficult to understand is because you try to explain the skeleton behind each code which is difficult to understand. It is easier to learn how to use a tool than learning in making the tool 😅 but I never give up in trying to make myself understand. Thank you for your hard work and efforts ❤
@psycho.2u
@psycho.2u 2 жыл бұрын
The best video I've ever seen about dependency injection so far
@KillerPhantom123
@KillerPhantom123 5 жыл бұрын
Great tutorial, love the new format!, thanks for everything Nick
@daoquanganh8aanh81
@daoquanganh8aanh81 2 жыл бұрын
great tutorial for me to understand how to implement DI, thank u 🎉
@niluniverse
@niluniverse 4 жыл бұрын
You are Oracle of Technology! You are making programming fun, and ridiculously easy.
@standiallo
@standiallo 3 жыл бұрын
This man is fit for I.O.C. !
@JagadishNallamilli
@JagadishNallamilli 9 ай бұрын
This is just Perfect!!
@faisletoismeme
@faisletoismeme 2 жыл бұрын
Wow, you are awesome. A great demonstration of your mastery. I am impressed.
@nishad3445
@nishad3445 4 жыл бұрын
Amazing run through of an unfamiliar problem for me. Keep up the awesome content!
@CrapE_DM
@CrapE_DM 3 жыл бұрын
So much of that logic should be kept in the ServiceDescriptor (with different subtypes to get rid of a lot of the ifs). That and a little bit more cleaning, and this would be perfectly fine. Since you did this live while seeming to make sure you stay at a decent pace, this is pretty good work.
@CrapE_DM
@CrapE_DM 3 жыл бұрын
But, personally, I hate using reflection to instantiate stuff. So, instead of registering implementation types, I would pass in functions to call. It's a bit more manual on the part of the app creator, but it removes some runtime errors and moves them to compile time.
@alihsanelmas
@alihsanelmas 2 жыл бұрын
Nice demonstration!
@shuvo9131
@shuvo9131 3 жыл бұрын
Thanks Nick. This tutorial is very informative and waiting to see more.
@m.kozylov
@m.kozylov 3 жыл бұрын
Thanks! It would be interesting to see implementation of the scoped service provider.
@RahulSingh-il1xk
@RahulSingh-il1xk 3 жыл бұрын
Hi Nick, This is your new fan 😊. I had one observation, don't you think we need to modify Line 26 of GetService() for transient services when the user provides the implementation. Currently, it returns the same implementation (singleton) instead of instantiating a new one.
@arashmalek5224
@arashmalek5224 4 жыл бұрын
good job. by this tutorial, I understand the concept of dependency injection very well.
@Radictor44
@Radictor44 3 жыл бұрын
I love your curiosity
@sezif3157
@sezif3157 2 жыл бұрын
this video is gold bro , ty :)
@bsgamer5069
@bsgamer5069 2 жыл бұрын
I want to buy your Dependency injection course. Does it explain about the reflection part ?
@turkodeco
@turkodeco 3 жыл бұрын
Hey, which keyboard are you using?
@martinprohn2433
@martinprohn2433 2 жыл бұрын
Is it really good practive to throw a literal "Exception"? I doubt that: Because than the exception can only be caught with "catch(Exception)" which itself is already a code smell. Why not use "KeyNotFoundException", wouldn't that be the more appropriate exception type here?
@nickchapsas
@nickchapsas 2 жыл бұрын
Sure
@Anubis10110
@Anubis10110 2 жыл бұрын
Awesome stuff
@armanx2
@armanx2 3 жыл бұрын
I was wondering what if you would write extension method for Object and call it from anywhere in class to get your Dependencies and get your dependency without using activator would not that be more performant ? I have never seen any Dependency injector doing it but the idea i wonder if that would work. I will try out once I have time :)
@mofolom
@mofolom 4 жыл бұрын
it would have been nice to build this using unit tests. looking at what you want, then verifying it. this looks like you know what you want to do. don't trust the debugger, write the tests.
@vbaclasses3553
@vbaclasses3553 2 жыл бұрын
I would love to see this done TDD as well.
@xHaplo
@xHaplo 3 жыл бұрын
Hey @Nick Chapsas, amazing videos! Did you ever get around to writing the Scoped implementation? would really like to see your, well, implementation for it :)
@marsen_lin
@marsen_lin 3 жыл бұрын
How did you do it so fast? 2:02 Copy the to other lines?
@11r3start11
@11r3start11 3 жыл бұрын
in visual studio and many other editors its Crtl + D
@jckprobability5204
@jckprobability5204 4 жыл бұрын
I love you Nick...
@svenheidemann3834
@svenheidemann3834 3 жыл бұрын
Made this one in python, really funny :D
@stebberg
@stebberg 3 жыл бұрын
Very cool
@adoulou340
@adoulou340 3 жыл бұрын
Great video, could we register 2 classes which implement the same interface ? Thanks
@paulkoopmans4620
@paulkoopmans4620 3 жыл бұрын
In Nick's example you could have registered a second one... but you would never be able to get it because it in the GetService method he looks it up by SingleOrDefault which would then throw an exception. If he would have used an dictionary as he commented then you could not a second registration. Now... there are dependency frameworks that can do that... castle is one that I know... but then your service registrations would have to come with extra qualifiers so that you can "find" the right one. Something like: RegisterTransient(AccountType.Debit); RegisterTransient(AccountType.Savings); Then a GetService or Resolve could be: GetService(AccountType.Savings);
@adoulou340
@adoulou340 3 жыл бұрын
@@paulkoopmans4620 Thanks Paul
@meditationheathandwellness781
@meditationheathandwellness781 3 жыл бұрын
Excellent
@my3m
@my3m 4 жыл бұрын
Quality content
@kieferFernandez
@kieferFernandez 3 жыл бұрын
Awesome!!
@Cognitoman
@Cognitoman 5 жыл бұрын
Hmm I’d like to create one for my vanilla JavaScript project as well
@maximusatenko4128
@maximusatenko4128 2 жыл бұрын
cool!
@Cognitoman
@Cognitoman 5 жыл бұрын
What’s up homie ?
@hokoder7371
@hokoder7371 4 жыл бұрын
if you dont mind, can you expand this tutorial with the di and ioc of asp.net core template project? i came across this tutorial when i was looking for something to understand their architecture. this tutorial is good but i could find similar or same examples from stackoverflow and codeprojct and i feel 30mins video is pretty long. cheers.
@mariomorazan9473
@mariomorazan9473 3 жыл бұрын
The fun part is when the constructors are Not parameterless XD
@nickchapsas
@nickchapsas 3 жыл бұрын
The video covers it with dynamic resolution
@SAXXSSX
@SAXXSSX 5 жыл бұрын
Hey nick, can u make asp.net core webapi microservices playlist?
@nickchapsas
@nickchapsas 5 жыл бұрын
I definitely wanna explore micro-services but on a more architectural level rather then implementation. A microservice is really a service that does one thing. This wouldn't be demonstrated properly in an asp.net core playlist since microservices can be from many different technologies and they usually are.
@vr4306
@vr4306 4 жыл бұрын
Nick Chapsas waiting for this
Creating a mocking library for .NET in C# FROM SCRATCH
30:33
Nick Chapsas
Рет қаралды 8 М.
What is Span in C# and why you should be using it
15:15
Nick Chapsas
Рет қаралды 260 М.
When Cucumbers Meet PVC Pipe The Results Are Wild! 🤭
00:44
Crafty Buddy
Рет қаралды 59 МЛН
Don't underestimate anyone
00:47
奇軒Tricking
Рет қаралды 20 МЛН
How Many Balloons To Make A Store Fly?
00:22
MrBeast
Рет қаралды 142 МЛН
I thought one thing and the truth is something else 😂
00:34
عائلة ابو رعد Abo Raad family
Рет қаралды 8 МЛН
Why Developers and Companies Hate .NET 9
10:56
Nick Chapsas
Рет қаралды 40 М.
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 885 М.
Dependency Injection Deep Dive | .NET & C# Essentials
38:01
Amichai Mantinband
Рет қаралды 26 М.
8 await async mistakes that you SHOULD avoid in .NET
21:13
Nick Chapsas
Рет қаралды 315 М.
Demystifying Dependency Injection Containers by Kai Sassnowski
26:46
Clean ASP.NET Core API using MediatR and CQRS | Setup
22:39
Nick Chapsas
Рет қаралды 325 М.
Dependency Injection на примере Uber fx | Эйч Навыки
17:43
Эйч Навыки — менторская программа
Рет қаралды 6 М.
Inversion of Control - Fun Fun Function
17:54
Fun Fun Function
Рет қаралды 69 М.
When Cucumbers Meet PVC Pipe The Results Are Wild! 🤭
00:44
Crafty Buddy
Рет қаралды 59 МЛН