[RESOLVED]Relation between Routing system & Action invoker & Model binding

I always got confused about these three essential terms used in any asp.net mvc web application:-

  1. Routing system
  2. Action invoker.
  3. Model binding.

Now let say that the user type the following URL

/Customer/Find?name=test%customer

And I have this simple action method:-

Public ActionResult Find (string name)

{//code goes here….

Return view();}

Then how will asp.net mvc framework handles this request and return a view to the user?, is this the correct scenario:-

  1. First of all the Routing system (assuming that I am using the default routing system )will extract the following info from the
    URL:-

-        The controller name is = Customer

-        The action method name is= Find

-        The URL segment is name = Test%customer

  1. After the routing system extracted the controller, action and parameters names ; the action invoker will search the available actions methods to find a suitable action method, that is within the “Customer" controller and has its name as “Find” and accept
    a parameters named “Name” ?
  2. When the action invoker find the related action method, the model binding process will start by converting the url segment “name=test%cusotmer” to a .net values in this case test%cusotmer as a string and pass it to the action method parameter.

Can anyone advice if this is the process when calling action method in asp.net mvc ?

Thanks

Yes, the sequence you have mentioned is correct, in my understanding.

First, Routing System determines controller, action based on url. ControllerActionInvoker will further process the request. DataBinder will be the next step before acting upon code we write inside action method.

See these references for the complete list of step by step actions happen under the hood:

http://blogs.msdn.com/b/varunm/archive/2013/10/03/understanding-of-mvc-page-life-cycle.aspx

http://www.asp.net/mvc/overview/getting-started/lifecycle-of-an-aspnet-mvc-5-application

Hope this helps.

Regards
Siva

Leave a Reply