asp.net mvc - How do I bind a model automatically in background without change action parameter? -
i have coded model binder return simple model. want bind model every controllers without change controller action parameters. there anyway it?
thanks!
a model binder associated given type. in application_start
:
modelbinders.binders.add(typeof(someviewmodel), new somemodelbinder());
this register somemodelbinder
model binder controller actions take someviewmodel
parameter. example:
public actionresult foo(someviewmodel model) { ... }
Comments
Post a Comment