C# Dependency Injection Explanation in .NET Core

Поделиться
HTML-код
  • Опубликовано: 10 апр 2019
  • Explanation of dependency injection by building a simple console app with a unit test and then refactoring it with dependency injection. This tutorial uses .NET Core and the Microsoft.Extensions.DependencyInjection Library.
    If you want to support me, I like coffee ☕ ko-fi.com/billytech
    Dependency Inversion Principle: en.wikipedia.org/wiki/Depende...
    Inversion of Control: en.wikipedia.org/wiki/Inversi...
    Dependency Injection
    en.wikipedia.org/wiki/Depende...
  • НаукаНаука

Комментарии • 55

  • @RafaAyadi
    @RafaAyadi Год назад

    Best explanation of DI on the internet. Thank you sir. Cheers from France.

  • @joyfulitconsultant6310
    @joyfulitconsultant6310 3 года назад +3

    By far the best explanation given about dependency injection in my opinion. I just loved the way you teach.

  • @dwainbrowne
    @dwainbrowne 4 года назад +4

    Really appreciate the effort that went into this video. I've struggled with some of these concepts for years and you have certainly cleared things up for me. Well done and thank you!!

  • @burakmutlu4156
    @burakmutlu4156 4 года назад +6

    Thanks man! This saved me a lot time. Documentations in the web make one confused about the issue and that's so rough to go over them. But your clarification and going over the issue with simple implementation slowly is so much understandable for beginners like us. Thank u again I appreciated it a lot.

  • @sc100200090
    @sc100200090 4 года назад +5

    That Really turned out to be a very Excellent & Quite Comprehensive Walkthrough really presenting the need of main need and importance of Dependency Injection Billy!
    Thanks!!!

  • @pmro
    @pmro Год назад

    I read Microsoft documentation, watched few videos and still couldn't fully understand how to implement DI... until Your video, thank You! Now I know what DI is, for what reason we use it, and how DI influence app architecture and design pattern.

  • @killia999
    @killia999 4 года назад +15

    I have to say, this is the first time I've ever understood what Dependency Injection is all about... too bad it's now 1AM and I'll forget it by the time I get up tomorrow.
    Great video!
    Thanks!

    • @triptisharma4731
      @triptisharma4731 4 года назад

      Same! Lol

    • @Alex-ABPerson
      @Alex-ABPerson 3 года назад +1

      I mean technically it's been scientifically proven that you remember stuff you learn well before you go to sleep, as it's fresh in your memory and your brain often processes your memories as you sleep ;)

    • @killia999
      @killia999 3 года назад

      @@Alex-ABPerson Yeeah... that never worked for me once :P

    • @Alex-ABPerson
      @Alex-ABPerson 3 года назад

      @Trevor Jonathan What does that have to do with this video? Or is this a bot

  • @satishvanahalli
    @satishvanahalli 2 года назад

    I have gone through plenty of documentations and videos. This is by far the best. Thank you.

  • @umair1661
    @umair1661 2 года назад

    One of the most excellent explanation of DI. Although its 5AM and my eyes are hurting, but worth every second.

  • @STUPIDYOUTUBE_HIDINGMSGS
    @STUPIDYOUTUBE_HIDINGMSGS 4 года назад +1

    If I could like this over and over I would. This is simple direct to the point tutorial of IoC principle that's easy to understand and unlike the other tutorials about DI from Lynda and PluralSight that are padded with talks which bores the learner, this one pretty much clears up my confusion, and has added up learning on MS container and unit testing.
    Thank you and please keep making tutorials on .net.

  • @abdellatifmerouan
    @abdellatifmerouan 3 года назад

    I would like to say Thank you a lot. I spent more then 3 months trying to understand Dependency Injection without success. This is the first time I were able to understand this topic. thanks again.
    Great Video!

  • @gilkdemoraesrodrigues8884
    @gilkdemoraesrodrigues8884 2 года назад

    Thank you very much.. the charts you put together and the easy implementation was perfect to teach/learn this!

  • @slavo.zhurba
    @slavo.zhurba 2 года назад

    Omg man, there’s best explain of di and ioc container I’ve seen🔥🔥🔥. All clear and simple. Thnx!

  • @rlclark50
    @rlclark50 3 года назад

    Great walk through with basic implementation of DI patterns.

  • @kipersonic0
    @kipersonic0 4 года назад +12

    Why this video was a tremendously good investment of my time:
    • Your explanation helped me understand the relationship between a Dependency Injection framework (in this case the one included in .NET Core) and the Moq library.
    • The way you created and declared the container in the Program class was another "aha!" moment for me.
    • Your voice speed is great for playing the video at 1.5x.
    Thank You so much.

    • @elijahcrosby6141
      @elijahcrosby6141 2 года назад

      I guess it is kind of randomly asking but does anyone know a good place to watch newly released series online?

    • @joemiles8402
      @joemiles8402 2 года назад

      @Elijah Crosby Flixportal :D

    • @elijahcrosby6141
      @elijahcrosby6141 2 года назад

      @Joe Miles thank you, signed up and it seems to work =) Appreciate it!

    • @joemiles8402
      @joemiles8402 2 года назад

      @Elijah Crosby glad I could help :)

  • @sen.alexandru
    @sen.alexandru 3 года назад

    amazing explanation. congrats Billy!

  • @lightweave
    @lightweave Год назад

    Very nice video! It's great because it shows a somewhat realistic enough scenario in full detail. 👍

  • @rpo3ge
    @rpo3ge 4 года назад +1

    Great explanation, it is easier than it looks on paper definitely.

  • @bradleynall2698
    @bradleynall2698 4 года назад +1

    This was great. Thank you for this.

  • @kumarsourav8851
    @kumarsourav8851 Год назад

    This is the best video on dependency injection. Great content. But where is Billy? Don't see any recent videos on the channel.

  • @rjamil
    @rjamil 3 года назад

    2021 and I'm learning new things aside from Dependency Injection! Thanks!

  • @jomynn
    @jomynn 2 года назад

    Thank you for Dependency Injection.

  • @davidpinto4192
    @davidpinto4192 4 года назад +1

    Awesome video. Thanks!

  • @cavanbiggs9179
    @cavanbiggs9179 3 года назад

    Great video showing implementation before and after, it would be awesome if you could do a series showing the standard design patterns.
    subbed!

  • @fiji895
    @fiji895 2 года назад

    great video man, thank you!

  • @soderiv9125
    @soderiv9125 5 лет назад +2

    Thanks this helped a lot.

  • @tevinmorake8924
    @tevinmorake8924 3 года назад

    Brilliant Billy!

  • @papamoneyph
    @papamoneyph 3 года назад

    excellent explanation, very clear and on point

  • @akshat9117
    @akshat9117 Год назад

    Really love it....cleared all my doubts.....

  • @1101claus
    @1101claus 3 года назад

    Great video, Thanks!

  • @Shakti_Singh_Om
    @Shakti_Singh_Om 4 года назад +1

    excellent video. thanks a lot.

  • @jamesfleming8238
    @jamesfleming8238 4 года назад +1

    I think this might be the clearest explanation, at 32:11 when you showed the diagram, it all just clicked :D Cheers

  • @liliya9284
    @liliya9284 3 года назад +1

    Really liked the video. Thank you so much for a great explanation. You should do your course on LinkedIn.

  • @janezvegan
    @janezvegan 3 года назад

    Thank you for this good explanation

  • @King-mj2bn
    @King-mj2bn Год назад

    Excellent and crystal clear breakdown of DI. Wish you had spent more time on Moq, though. That part felt rushed and I'm still extremely fuzzy on mock objects.

  • @junaid_aslam
    @junaid_aslam 2 года назад

    Nice stuff.

  • @rubayethkamal210
    @rubayethkamal210 3 года назад

    nicely explained

  • @bulgarian388
    @bulgarian388 5 лет назад

    I have a question... Say you're using MediatR to send a command for the app to do something, and the handler has one or more dependencies. You "could" pass the Container to the command (which can get ugly fast), and then have the command handler use that to get its dependencies, but how would/could you do it without passing the Container around?
    Great tutorial otherwise, thanks for taking the time to make it! I think you can skip the product.ToString() when you're in an interpolated string though.

  • @DedicatedManagers
    @DedicatedManagers 3 года назад

    Looks like it would be a great video. Unfortunately I watch videos at night when I have time and it’s on my phone because that’s what I have near me. The font is so small on my phone I can’t even make it out. It would be nice if you use a larger font size.

  • @omirrrr
    @omirrrr 4 года назад

    It looked like you weren't using Dependency Injection with the tests, but manuallly instantiating classes and passing to the constructor. Could you instead have just changed the IProductStockRepository in the service container to be the mock version instead?

  • @vemareddys
    @vemareddys 3 года назад

    How to handle dependency injection in the case of single interface implemented by multiple classes.

  • @010101dddm
    @010101dddm 3 года назад

    Perfect explanation. Is there a source code of this example?

  • @jaynick8933
    @jaynick8933 2 года назад

    This was great! You should be a professor :-) #NewSub

  • @brahmcdude685
    @brahmcdude685 3 года назад

    example is very complicated. it could be much simpler.

  • @brahmcdude685
    @brahmcdude685 3 года назад

    why are all DI videos on youtube so convoluted???????