How to Resolve Multiple Dependency Injection Implementations of the Same Interface in .NET

Поділитися
Вставка
  • Опубліковано 8 тра 2024
  • ►► Master Web API development Best Practices: bit.ly/3TnqoFQ
    ►► Build great web apps in Blazor WebAssembly: bit.ly/437g87T
    ►► Support us on Patreon and get the source code: / codemaze
    I will talk about one interesting challenge we all faced in our .NET projects - resolving multiple implementations of the same interface with the dependency injection.
    You will see that using the default dependency injection container offered by ASP.NET Core may reveal that the task, I will talk about, is more challenging than it initially appears.
    Well, let’s see it with an example.
    LINKS MENTIONED IN THE VIDEO
    ►► Factory Pattern with DI - • How to Use Factory Pat...
    FOLLOW US ON SOCIAL MEDIA!
    ►► / marinko-spasojevic
    ►► / codemazeblog
    ►► / codemazeblog

КОМЕНТАРІ • 9

  • @CodeMaze
    @CodeMaze  Місяць тому

    Thank you all for watching and for your support.
    ►► If you want to master Web API development using best practices, check out our Web API book: bit.ly/3x75ZMM
    ►► Also, to build great full-stack apps with Blazor, check out our course: bit.ly/3Pw3Y33

  • @changuanyu874
    @changuanyu874 Місяць тому +1

    I have been looking for this for so long thanks! ❤

    • @CodeMaze
      @CodeMaze  Місяць тому +1

      You're welcome! Thank you for watching the video.

    • @changuanyu874
      @changuanyu874 Місяць тому

      @@CodeMaze Can I use your method but different example for my blog post?

    • @CodeMaze
      @CodeMaze  Місяць тому

      Hi. Well yes. I didn't reinvent a wheel here, someone has probably already talked about this topic somewhere. Just use your words and your examples and you are good to go without plagiarism. After all, the original content is always the best one.

  • @10Totti
    @10Totti Місяць тому +1

    Best tutorial!

    • @CodeMaze
      @CodeMaze  Місяць тому

      Thank you. Thanks for watching this one.

  • @ugochukwuumerie6378
    @ugochukwuumerie6378 Місяць тому

    I have been using the resolver pattern, but the keyed services are pretty cool, saves you the stress of keeping track of those switch cases. Awesome content. Thanks

    • @CodeMaze
      @CodeMaze  Місяць тому

      I completely agree. It is great that we have different options at disposal. Thank you for watching the video and your comment.