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

Поделиться
HTML-код
  • Опубликовано: 27 сен 2024
  • Dependency Injection in C# in simple word with Real Time example.
    Github Repo: github.com/emp...
    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.

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

  • @ΜάριοςΜιχαηλίδης-κ9ε

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

  • @imadabab
    @imadabab 9 месяцев назад

    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

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

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

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

    Nice