Hands-On Full:Stack Web Development with ASP.NET Core
上QQ阅读APP看书,第一时间看更新

Model binding

The data that is carried with an HTTP request that is mapped to parameters that you define in your method's, signature in a process called Model binding. The HTTP request can contain data inside the various parts that compose it:

  • Route tokens 
  • Query strings
  • Message body
  • Request headers

ASP.NET Core's model binding defines the rules of how to map each value to its correct method parameter.     

We already saw how to bind route tokens to method parameters in the Routing section of this chapter, so we won't repeat ourselves, and will instead concentrate on the other types of bindings.