ASP.NET MVC 3: Updating controller factories to RC
With ASP.NET MVC 3 RC there is change in IControllerFactory interface. This interface includes new method called GetControllerSessionBehavior(). This method returns value from SessionStateBehavior enum. ASP.NET MVC uses this method to find out how to handle session for given controller.
If you don’t plan to do any advanced stuff with session state then the easiest way to get your controller factories work again is to add the following method to them.
public SessionStateBehavior GetControllerSessionBehavior
(RequestContext requestContext, string controllerName)
{
return SessionStateBehavior.Default;
}
Now your controller factories should compile again.
Do you even need to have a controller factory any more? I am using structuremap and only implement the IDependencyResolver interface – MVC 3 uses this internally and the controller resolution is handled automatically.
Do you have some custom behaviour inside your controller factory that you wouldn’t get if you just implemented the generic dependency resolver?
good advice, thanks.