Creating custom Lifetime Manager classes?

Jul 15, 2010 at 8:04 AM
Edited Jul 15, 2010 at 1:57 PM
Hi, In Unity 2.0 documentation I see this line - "You can create custom LifetimeManager classes if you require additional functionality not available in the default lifetime managers. Documentation to help you do this is available from the Unity Community Web site on CodePlex." - but could not locate any documentation which helps creating custom Lifetime manager class. 1. Can you please point me to the right location? 2. In my ASP.Net MVC Web application I need to pass IUserSession object to my Service class and then inturn to my Repository class so that some information about the current user is passed. When user logs in I build this UserSession object where I keep his accesslist among other stuff. I do not want to build this object every request and want to use the same till his session is alive. Is there anything out-of-box I can use in unity to handle the lifetime of this object (per user session), If not How do I build the Lifetime manager class to tackle this. Thanks & Regards, Ajay
Feb 8, 2011 at 12:41 AM


There's currently no Unity extensibility documentation. For the PerSessionLifetimeManager extension, we have an example posted here:

It is for v1.1, but it should give some basic direction.