Model Binding Architecture in ASP.NET MVC
Model Binding:
Model binding is the process of binding values posted over an HTTP request to the parameters used by the controller’s methods.
Model Binding Architecture in ASP.NET:
The model-binding logic is encapsulated in a specific model-binder class. The binder works under the control of the action invoker and helps to figure out the parameters to pass to the selected controller method. In ASP.NET MVC, there are three distinct models:
-
i. Input Model
ii. Domain Model
iii. View Model
The former describes the data you work with within the middle tier and is expected to provide a faithful representation of the entities and relationships that populate the business domain. These entities are typically persisted by the data-access layer and consumed by services that implement business processes.
This domain model pushes a vision of data that is, in general, distinct and likely different from the vision of data you find in the presentation layer. The view model just describes the data that is being worked on in the presentation layer.
Input Model: It provides the representation of the data being posted to the controller.
Domain Model: It is the representation of the domain-specific entities operating in the middle tier.
View Model: It provides the representation of the data being worked on in the view.