I have something similar to the following method:
public ActionResult Details(int id)
{
var viewData = new DetailsViewData
{
Booth = BoothRepository.Find(id),
Category = ItemType.HotBuy
};
return View(viewData);
}
and the following route:
routes.MapRoute("shows","shows/{controller}/{action}/{id}", new {id = 0});
Everything worked well before the beta when I had Preview 3. Now the method will correctly populate the identifier when the action is first run. However, the second time the controller ModelStatecontains the value of the last use. This leads to ActionInvokerusing it in the method parameter instead of the value Route.
So, if I call the action twice on two different objects, the results are as follows:
www.mysite.com/shows/Booth/Details/1 => Details(1)
www.mysite.com/shows/Booth/Details/2 => Details(1) //from ModelState["id"]
From my quick scan with Reflector, it looks like it binds the parameters to ModelState first, and then to routes. However, I did not even write anything from the model. As far as I can tell, ModelState should not contain anything.
-, , - , - , ? ModelState , .
EDIT:
, , , -, DefaultValueProvider, IoC, Asp.Net. , , DefaultValueProvider ControllerContext , , . , RouteData RouteData.