After all, parameter binding is to receive an Http request and convert it into. NET type makes the signature of the operation method easier to understand.
The request message includes all the requested information, such as the request address (URL) with the query string, the content body and the header information. No parameter binding.
In the case of, each operation method needs to receive the request message and manually extract parameters from it, as shown below:
The public object myaction (http request message request) {//is explicitly called to get parameters from the request object int id = int. Parse (request. RequestUri.ParseQueryString()。 get(" id ")); //Need error logic! Customer c = request. Content.ReadAsAsync()。 Results; //should be asynchronous! //Use id and customer now}
Obviously, this method is ugly, error-prone, repetitive, and difficult for unit testing. We want the signature of the action to look like this:
The public object my action (int id, customer c) {} binds to TC date.