Dependency Injection in C# in simple word with Real Time example

Sdílet
Vložit
  • čas přidán 26. 03. 2022
  • Dependency Injection in C# in simple word with Real Time example.
    Github Repo: github.com/empowerlearninghub...
    The dependency injection (DI) software design pattern is supported by .NET, which is a technique for achieving Inversion of Control (IoC) between classes and their dependencies.
    Dependency injection addresses these problems:
    • The use of an interface to abstract the dependency implementation.
    • Registration of the dependency in a service container in startup.cs
    • Injection of the service into the constructor of the class where it's used. The framework takes on the responsibility of creating an instance of the dependency and disposing of it when it's no longer needed.
  • Věda a technologie

Komentáře • 4

  • @user-yj8sl1kd8p
    @user-yj8sl1kd8p Před 9 měsíci

    Nice quick and easy. Well done my friend. You just got yourself a follower.

  • @imadabab
    @imadabab Před 6 měsíci

    Thanks a lot for this valuable explanaiton. in case you have a new class, also, you will create an interface to it to register it, so, the place you want to consume it, you have to change the interface injection to the new interface, please correct me if I'm wrong. Also, I have inheritance "Abstract Class" with some common implementation for subclasses, using DI with inheritance is impossible, because they are different concepts. I tried it a lot, I didn't succeed. Appreciate if you correct me if I'm wrong. Thanks

  • @riteshkumaryadav1287
    @riteshkumaryadav1287 Před rokem

    Nice

  • @rory6315
    @rory6315 Před rokem

    Nice and quick tutorial however you spelt 'Social' wrong.