microsoft-dependency-injection
microsoft-dependency-injection copied to clipboard
Configurable Scoped registration mapper
I am using this library to configure services on IServiceCollection
and then transfer registrations to IUnityContainer
by using .BuildServiceProvider(IUnityContainer ...)
extension method.
Currently I am trying to use it on Asp Net MVC (old) project and there is only a problem with Scoped registrations which gets mapped to HierarchicalLifetimeManager
which in such configuration works like a singleton.
I saw some issues about usage of PerRequestLifetimeManager
like #84 which looks like solution would be complex, but I was wondering if there could be some setting exposed where we could configure mapping for Scoped registration? If that would be simple lambda then we could just return PerRequestLifetimeManager
instance if hosting application is legacy MVC project
https://github.com/unitycontainer/microsoft-dependency-injection/blob/03768b7ae7d0b45ddad4ca592f9c7f8699c3b910/src/Configuration.cs#L68
Is there any chance that this is a good idea?
I am afraid #84 is the easier option as opposed to what you suggesting.