How do I create a custom model binder using the `BindModel(HttpActionContext actionContext…` signature?

后端 未结 4 1872
感动是毒
感动是毒 2020-12-08 14:40

I need to know how to create a custom IModelBinder in MVC 4 and it has been changed.

The new method that has to be implemented is :

boo         


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-08 15:13

    There are 2 IModelBinder interfaces:

    1. System.Web.Mvc.IModelBinder which is the same as in previous versions and hasn't changed
    2. System.Web.Http.ModelBinding.IModelBinder which is used by the Web API and the ApiController. So basically inside this method you must set the actionContext.ActionArguments to the corresponding values. You no longer return a model instance.

提交回复
热议问题