I have a custom model binder to get data from session, but I also would like to use the default binder from time to time.
Is it possible to choose model binder in action signature instead of using UpdateModel?
Example
public ViewResult MyAction(Cart useSessionBinder, Cart useFormData)
{}
Thanks
You could use the
[ModelBinder]attribute:Obviously you should have not assigned globally your custom model binder to the
Cartclass in yourApplication_Start, otherwise it will automatically apply to all instances ofCartappearing as action parameters.