Introducing ModelBinders
ModelBinders
are responsible for binding the incoming data to specific action method parameters. They bind the data sent with the request to the parameters. The default binders are able to bind data that is sent via QueryString
, or sent within the request body. Within the body, the data can be sent in URL format or JSON.
The model binding tries to find the values in the request by parameter names. The form values, route data, and query string values are stored as a key-value pair collection and the binding tries to find the parameter name in the keys of the collection.
Let's demonstrate how this works with a test project.