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