MYMVC the process of finding action in the box

Source: Internet
Author: User
First, we'll first register MYMVC's httphandlerfactory in Web. config, which is the portal to the entire framework.
The GetHandler () method is called during the line of ASP, and finally my code has the chance to run!
The first line of code executed by the framework is:

According to the request path, navigate to the Actioncontrolleractionpair pair = Urlparser.parseajaxurl (virtualpath) to be executed;
public sealed class controlleractionpair{public    string Controller;    public string Action;} The static method Urlparser.parseajaxurl () is specifically used to parse the URL and return Controlleractionpair:

The code is simple, the core is actually the regular expression, the name of extracting controller,action from the URL depends on it.
As for the use of regular expressions, I think this is a basic skill, which is skipped here.

Then look at the second invocation of Ajaxhandlerfactory:

Gets the call information for the internal representation invokeinfo Vkinfo = Reflectionhelper.getajaxinvokeinfo (pair);

The Reflectionhelper class is a tool class that is used internally, specifically for reflection processing, and the relevant code for the Ajaxaction lookup process is as follows (note the comments in the code):

The above is ajaxaction to find the relevant 4-segment code:
1. In the static constructor of Reflectionhelper, I loaded all the Ajaxcontroller.
2. The Getajaxcontroller method is used to return the type description of a controller based on the name of a controller.
3. The Getajaxaction method is used to return the description information of the action based on the type of the controller and the name of the action to invoke.
4. The Getajaxinvokeinfo method is used to translate into more specific descriptive information based on the Controlleractionpair description obtained from ajaxhandlerfactory.

In the code, the action's lookup process takes a deferred load pattern, saving a collection of Action description information I used thread-safe hashtable

"Recommended"

1. Special recommendation : "PHP Programmer Toolkit" V0.1 version download

2. asp free Video Tutorial

3. an entry-level. NET MVC Instance

4. the. NET MYMVC Framework performs an action-detailed procedure

5. the. NET MYMVC Framework How to assign values to a method tutorial

6. the. NET MYMVC Framework processes the return value tutorial

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.