I just updated my project from ASP.NET MVC1.0 to ASP.NET MVC4.0
One thing that scares me is the next sentence in the MVC3.0 upgrade documentation
In previous versions of ASP.NET MVC, action filters are created per request, except in a few cases. Such behavior was never guaranteed, but only the implementation detail and filter contract should have been considered stateless. In ASP.NET MVC 3, filters are cached more aggressively. Therefore, any custom action filters that improperly save the state of an instance may be violated.
I think there is no easy way to check for errors caused by improperly maintaining the state of an instance. If I have a problem, I am sure that I will only find it in production.
What does the improperly saved instance state mean here?
I have this code:
public override void OnActionExecuting(ActionExecutingContext filterContext) { ProductModel productModel = new ProductModel() filterContext.ActionParameters["model"] = productModel; }
Is this a sample of an improperly saved instance state?
source share