I am considering using Unity to manage the lifetime of a custom user class instance. I am planning on extending the LifetimeManager with a custom ASP.NET session manager.
Why not use the cache object instead...then you can use it both from win and web. Like this:
IUnityContainer container= HttpRuntime.Cache.Get("Unity") as IUnityContainer;
if (container == null)
{
container= // init container
HttpRuntime.Cache.Add("Unity",
container,
null,
Cache.NoAbsoluteExpiration,
Cache.NoSlidingExpiration,
CacheItemPriority.NotRemovable,
null);
}
// return container or something
HttpRuntime.Cache will work both in win and web