Iterating on an ASP.NET MVC Model Binder
Posted by: K. Scott Allen,
on 06 May 2009 |
View original | Bookmarked: 0 time(s)
After my last post on model binding tips Ive had a number of questions about the nuances of model binding. Lets work through a sample. Imagine you have a Recipe class that can hold all the information you need to make Love Mussels, and now you've decided to build a model binder to bind and validate recipes. Iteration 1 Lets start with the naive approach. This code has a number of problems. public class RecipeModelBinder : IModelBinder
{
public object BindModel(ControllerContext controllerContext,...