mardi 5 mai 2015

Unity.Mvc3 vs Unity.Mvc

Using the Unity.Mvc3 with a Mvc 3 application, i could register my IDummyService as follows:

container.RegisterType<IDummyService, DummyService>(new HierarchicalLifetimeManager());

On each web request, a new instance of my IDummyService is created (as explained in this article), but since I upgraded Mvc 3 to Mvc 4 and hense Unity.Mvc3 to Unity.Mvc, an single instance is created and used across all web requests, untill restarting the app. Basically, IDummyService is a singleton in a Mvc 4 application when using HierarchicalLifetimeManager. For me this is hard to believe this is intended new behavior in Unity.Mvc.

Is there a better explanations for this?

Aucun commentaire:

Enregistrer un commentaire