Closed AntMaster7 closed 1 year ago
I found an option to solve this issue with container.Options.ConstructorResolutionBehavior.
Simple Injector does not follow the MS.DI Conforming Container contract and can't does not allow the built-in container to be replaced with Simple Injector. Integration with ASP.NET Core works differently with Simple Injector. Please follow the official integration guide. This documentation describes how to integrate Simple Injector with ASP.NET Core.
I replaced the entire default service provider in my ASP.NET Core application with Simple Injector because I need the dependency on
IServiceProvider
to resolve to the Simple Injector container. Unfortunately Simple Injector requires implementation types to have only one constructor which is an issue. When Simple Injector tries to resolveIHostLifetime
, which is implemented by the internalConsoleLifetime
class from Microsoft, it fails because this implementation type has two constructors. In my opinion Simple Injector should be able to handle this by selecting the constructor with the most satisfiable dependencies. Or is there a way for me to implement this behavior on top of Simple Injector?