Is there an attribute that can turn off model binding for complex action parameters?
My scenario is this: I'm using Linq to SQL but make the generated classes implement interfaces. For example, IUser. Some of my controllers actions accept IUser parameters and some of my views bind IUser models, but I don't want the default model binder to construct it. I use Action Filters for that. The idea behind this is that if an action requires user details, the action filter gets it from the database before the action is invoked.
To get around the error that occurs when the DefaultModelBuilder gets fired up, I've made a null model binder that just returns null from CreateModel.
ModelBinderDictionary binders = System.Web.Mvc.ModelBinders.Binders;
binders[typeof(IUser)] = new NullModelBinder();