Request/Thread singletons in MVC projects

Apr 9, 2013 at 11:10 PM
Hi.

I have a service which I want to use PerRequest for contollers, but PerThread for code kicked off via TaskFactory.StartNew (which I am getting hold of using Munq.MVC3.MunqDependencyResolver.Container.Resolve<T> in the task).

Which should I register the service with? Is there a mixed mode, which uses PerThread when HttpContext.Current is null, or some other approach I should take?

thanks!