I am implementing custom model binder. I researched how to do it and found out that in case of WebApi I need to implement IModelBinder interface.
My implementation looks like this:
public class ModelBaseBinder : IModelBinder
{
public bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext)
{
if ((bindingContext.Model is MyModel))
{
//my code here
controller.InitModel(model);
return true;
}
return false;
}
}
I am just not sure if my implenentaton is complete. Do I need to call any default WebApi BindModel in order my custom implementation work?