Model binding

Model binding is the process of mapping the Model data coming from the View to the ViewModel parameter of the action method in the Controller.

Let us consider a simple form with a couple of form fields—Name and EmailID. On the submission of the form, these values would be mapped to the ViewModel object of the action method of the Controller. Model binding takes care of this mapping. The Model binder looks for a match in the form fields, query strings, and request parameters.

In the preceding example, any class with these properties would be picked up by ModelBinder without any issues.

As the following Person class contains the Name and EmailID properties, the model binder would not complain about using this model for mapping the entered ...

Get Learning ASP.NET Core MVC Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.