I have a library that configures dependency injection for another library (via IServiceCollection
extension). However, that other library requires a different implementation of a service that is already registered in the application that will be using it even though only one implementation of that service is expected in the application.
I.e., Application relies on Service A with implementation A1 and Service B (from a separate library) that relies on Service A with implementation A2. Both implementations A1 and A2 come from libraries and are internal
(registered using library-specific IServiceCollection
extensions).
What is the way to make this work without exposing internal
classes or changing the service implementation used by the application?