How to dynamically inject a service based on the output of another service
I have 2 possible implementations of an interface, and in my Program.cs I want to dynamically inject the right one. However, the logic of which one to inject depends on another service being used. Previously in I was doing this:
Dependency injection with interfaces with netcore
I’m trying to find a nice way to do dependency injection with a list of interfaces. I have multiple “parsers”, where each type of parser can handle parsing multiple files specific for that parser.
Multiple instances of an object that is provided through dependency injection
Let’s day I have a service that sends emails. This class also needs DI to get settings and add a logger. Here’s a trivial implementation: