| 1. |
What is model binding in ASP.NET? |
|
Answer» Controllers and views need to work with data that comes from HTTP requests. For example, routes may provide a key that identifies a record, and posted form FIELDS may provide model properties. The process of converting these string values to .NET objects could be complicated and something that you have to do with each request. Model binding automates and simplifies this process. The model binding system fetches the data from multiple sources such as form fields, route data, and query strings. It also provides the data to controllers and views in method parameters and properties, converting plain string data to .NET objects and types in the process. Example: And the app receives a request with this URL: http://yourapp.com/api/Posts/5?ArchivedOnly=trueAfter the routing selects the action method, model binding EXECUTES the following steps.
Some other examples of attributes include: |
|