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 Жыл бұрын
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 Жыл бұрын
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.2u2 жыл бұрын
The best video I've ever seen about dependency injection so far
@KillerPhantom1235 жыл бұрын
Great tutorial, love the new format!, thanks for everything Nick
@daoquanganh8aanh812 жыл бұрын
great tutorial for me to understand how to implement DI, thank u 🎉
@niluniverse4 жыл бұрын
You are Oracle of Technology! You are making programming fun, and ridiculously easy.
@standiallo3 жыл бұрын
This man is fit for I.O.C. !
@JagadishNallamilli9 ай бұрын
This is just Perfect!!
@faisletoismeme2 жыл бұрын
Wow, you are awesome. A great demonstration of your mastery. I am impressed.
@nishad34454 жыл бұрын
Amazing run through of an unfamiliar problem for me. Keep up the awesome content!
@CrapE_DM3 жыл бұрын
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_DM3 жыл бұрын
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.
@alihsanelmas2 жыл бұрын
Nice demonstration!
@shuvo91313 жыл бұрын
Thanks Nick. This tutorial is very informative and waiting to see more.
@m.kozylov3 жыл бұрын
Thanks! It would be interesting to see implementation of the scoped service provider.
@RahulSingh-il1xk3 жыл бұрын
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.
@arashmalek52244 жыл бұрын
good job. by this tutorial, I understand the concept of dependency injection very well.
@Radictor443 жыл бұрын
I love your curiosity
@sezif31572 жыл бұрын
this video is gold bro , ty :)
@bsgamer50692 жыл бұрын
I want to buy your Dependency injection course. Does it explain about the reflection part ?
@turkodeco3 жыл бұрын
Hey, which keyboard are you using?
@martinprohn24332 жыл бұрын
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?
@nickchapsas2 жыл бұрын
Sure
@Anubis101102 жыл бұрын
Awesome stuff
@armanx23 жыл бұрын
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 :)
@mofolom4 жыл бұрын
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.
@vbaclasses35532 жыл бұрын
I would love to see this done TDD as well.
@xHaplo3 жыл бұрын
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_lin3 жыл бұрын
How did you do it so fast? 2:02 Copy the to other lines?
@11r3start113 жыл бұрын
in visual studio and many other editors its Crtl + D
@jckprobability52044 жыл бұрын
I love you Nick...
@svenheidemann38343 жыл бұрын
Made this one in python, really funny :D
@stebberg3 жыл бұрын
Very cool
@adoulou3403 жыл бұрын
Great video, could we register 2 classes which implement the same interface ? Thanks
@paulkoopmans46203 жыл бұрын
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);
@adoulou3403 жыл бұрын
@@paulkoopmans4620 Thanks Paul
@meditationheathandwellness7813 жыл бұрын
Excellent
@my3m4 жыл бұрын
Quality content
@kieferFernandez3 жыл бұрын
Awesome!!
@Cognitoman5 жыл бұрын
Hmm I’d like to create one for my vanilla JavaScript project as well
@maximusatenko41282 жыл бұрын
cool!
@Cognitoman5 жыл бұрын
What’s up homie ?
@hokoder73714 жыл бұрын
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.
@mariomorazan94733 жыл бұрын
The fun part is when the constructors are Not parameterless XD
@nickchapsas3 жыл бұрын
The video covers it with dynamic resolution
@SAXXSSX5 жыл бұрын
Hey nick, can u make asp.net core webapi microservices playlist?
@nickchapsas5 жыл бұрын
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.