


Detailed explanation of the process of finding Action in MyMVC box
First, we need to register MyMVC's HttpHandlerFactory in web.config, which is the entrance to the entire framework.
In the ASP.NET pipeline process, the GetHandler() method will be called, and finally my code has a chance to run!
The first line of code executed by the framework is:
// 根据请求路径,定位到要执行的ActionControllerActionPair pair = UrlParser.ParseAjaxUrl(virtualPath);
public sealed class ControllerActionPair{ public string Controller; public string Action;} 静态方法UrlParser.ParseAjaxUrl()就是专门用来解析URL并返回ControllerActionPair的:
The code is very simple. The core is actually the regular expression, which extracts the Controller from the URL and the name of the Action depends on it.
As for the use of regular expressions, I think this is a basic skill and will be skipped here.
Let’s look at the second call of AjaxHandlerFactory:
// 获取内部表示的调用信息InvokeInfo vkInfo = ReflectionHelper.GetAjaxInvokeInfo(pair);
The ReflectionHelper class is an internal tool class specifically used for reflection processing. The relevant code for the AjaxAction search process is as follows (note the Comments):
The above is the 4 pieces of code related to AjaxAction search:
1. In the static constructor of ReflectionHelper, I loaded All AjaxControllers.
2. The GetAjaxController method is used to return the type description of a Controller based on its name.
3. The GetAjaxAction method is used to return Action description information based on the type of Controller and the name of the Action to be called.
4. The GetAjaxInvokeInfo method is used to convert the ControllerActionPair description obtained from the AjaxHandlerFactory into more specific description information.
In the code, the search process of Action adopts delayed loading mode. To save the collection of Action description information, I use threadsafetyHashtable
[Related recommendations]
1. Special recommendation: "php Programmer Toolbox" V0.1 version download
3. Entry-level .NET MVC Example
4. . NET MyMVC framework detailed explanation of the process of executing Action
5. .NET MyMVC framework tutorial on how to assign values to methods
6. .NET MyMVC framework tutorial on processing return values
The above is the detailed content of Detailed explanation of the process of finding Action in MyMVC box. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



DJI has not confirmed any plans to introduce a new action camera yet. Instead, it seems that GoPro will get ahead of its rival this year, having teased that it will introduce two new action cameras on September 4. For context, these are expected to a

Almost a year has passed since DJI released the Osmo Action 4 (curr. $299 on Amazon). Since then, the company has focused on its other divisions, including new RS camera gimbals. On top of that, it has introduced various drones as well like the Avata

In some cases, we want to perform some asynchronous operations in Vuex, such as network requests, which must be asynchronous. How to deal with this situation? Let me introduce to you the Action asynchronous operation of Vuex state management. I hope it will be helpful to friends in need. !

Insta360hasreleasedanewactioncamera,itssecondoftheyearaftertheInsta360X4(curr.$499.99onAmazon).Asexpected,thecompanyhasintroducedtheGo3S,anupgradedthatGo3thatadds4Kvideorecordingcapabilities.Specifically,whileInst

GoPro has now introduced its annual action camera refresh. Unlike in recent years, the company has decided to release two models. However, it has not returned to 360-degree cameras, despite teasing this time last year that it would replace the Max wi

Most operations in elasticsearch are through corresponding actions, which are in the action package. Its structure is shown in the figure below: The above figure is a partial screenshot of the action package, which corresponds to the actions of each function. The packages of each action are also very similar to index. The implementation of these actions is also very similar. They are all basic self-actions. The following figure shows the inheritance relationship of indexaction: Because these actions do not actually implement the corresponding functions, they are just a proxy, so the implementation is also very simple. Their main function is to provide methods for creating new responses and requests and their corresponding actions.

Details of a completely new GoPro action camera has leaked online alongside equivalent information about the Hero 13 Black. Please note that the information contained below is said to originate from an Amazon US listing that has since now been remove

The Amazfit GTR 3 Pro Limited Edition is currently on sale at Amazon for just $124.99, down 40% from its list price of $209.99. Compared to the standard version that has an aluminum case, the Amazfit GTR 3 Pro Limited Edition uses hand-polished stain
