Using Unity.Mvc3 with the Mvc 3 application, I can register mine IDummyServiceas follows:
container.RegisterType<IDummyService, DummyService>(new HierarchicalLifetimeManager());
Each web request creates a new instance of mine IDummyService(as described in the article ), but since I upgraded Mvc 3 to Mvc 4 and hense Unity.Mvc3 to Unity.Mvc, one instance is created and used in all web requests until the application is restarted . Basically, it IDummyServiceis a singleton in an Mvc 4 application when used HierarchicalLifetimeManager. It’s hard for me to believe that this is intended for new behavior in Unity.Mvc.
Are there any better explanations for this?
source
share