Procedures for the. NET MYMVC Framework to perform action

Source: Internet
Author: User
In the Ajaxhandlerfactory GetHandler method, you will eventually create a actionhandler, which is a httphandler, which will be called in the 15th step of the pipeline (referencing the blog "Write your own service framework with ASP." In the order).

Note: The GetHandler method of Ajaxhandlerfactory is called in the 10th step, and the 12th step is to prepare the session (non-in-process mode), so you must decide how to use the session before the 12th step.

All action codes are executed in Actionhandler:

Internal class actionhandler:ihttphandler{    internal Invokeinfo invokeinfo;    public void ProcessRequest (HttpContext context)    {        //Call the Core tool class, execute action        actionexecutor.executeaction ( Context, this. invokeinfo);    }

The ExecuteAction implementation process is as follows:

internal static void ExecuteAction (HttpContext context, Invokeinfo Vkinfo) {if (context = = null) throw new Argu    Mentnullexception ("context");    if (Vkinfo = = null) throw new ArgumentNullException ("Vkinfo");    Call Method Object result = executeactioninternal (context, vkinfo);    Set OutputCache Outputcacheattribute OutputCache = vkinfo.getoutputcachesetting ();    if (OutputCache! = null) Outputcache.setresponsecache (context);    The return result of the processing method Iactionresult Executeresult = result as Iactionresult;    if (Executeresult! = null) {executeresult.ouput (context); } else {if (result! = NULL) {//plain type result context.            Response.ContentType = "Text/plain"; Context. Response.Write (Result.        ToString ()); }}}internal Static Object Executeactioninternal (HttpContext context, Invokeinfo Info) {//Prepare parameters to be passed to the calling method object[] Parameters = Getactioncallparameters (context, info.    Action); Call the method if (info. Action.Hasreturn) return info. Action.MethodInfo.Invoke (info.    Instance, parameters); else {info. Action.MethodInfo.Invoke (info.        Instance, parameters);    return null; }}

Before I did not say the time to call Setresponsecache (), this time is here: after executing the action.
Once the outputcache has been set, the return value is processed.

In the previous code, there was an important call:

Prepare parameters to be passed to the calling method object[] Parameters = getactioncallparameters (context, info. Action);

"Recommended"

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

2. asp free Video Tutorial

3. an entry-level. NET MVC Instance

4. MYMVC The process of finding action in the box

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

6. the. NET MYMVC Framework How to assign values to a method 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.