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
|
case ServiceLifetime.Scoped: |
Is there any chance that this is a good idea?
I am using this library to configure services on
IServiceCollectionand then transfer registrations toIUnityContainerby 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
HierarchicalLifetimeManagerwhich in such configuration works like a singleton.I saw some issues about usage of
PerRequestLifetimeManagerlike #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 returnPerRequestLifetimeManagerinstance if hosting application is legacy MVC projectmicrosoft-dependency-injection/src/Configuration.cs
Line 68 in 03768b7
Is there any chance that this is a good idea?