我們知道作為Controller的類型直接或者間接實現了System
public interface IController
{
void Execute(RequestContext requestContext)
}
定義在IController接口中的Execute是以同步的方式執行的
public interface IAsyncController : IController
{
IAsyncResult BeginExecute(RequestContext requestContext
AsyncCallback callback
void EndExecute(IAsyncResult asyncResult)
}
抽象類System
public abstract class ControllerBase : IController
{
//其他成員
protected virtual void Execute(RequestContext requestContext)
protected abstract void ExecuteCore()
void IController
public ControllerContext ControllerContext { get; set; }
public TempDataDictionary TempData { get; set; }
public object ViewBag { [return: Dynamic] get; }
public ViewDataDictionary ViewData { get; set; }
}
ControllerBase具有如下幾個重要的屬性
在ASP
public class ControllerContext
{
//其他成員
public ControllerContext()
public ControllerContext(RequestContext requestContext
ControllerBase controller)
public ControllerContext(HttpContextBase httpContext
RouteData routeData
public virtual ControllerBase Controller { get; set; }
public RequestContext RequestContext { get; set; }
public virtual HttpContextBase HttpContext { get; set; }
public virtual RouteData RouteData { get; set; }
}
顧名思義
通過HttpContext和RouteData屬性返回的HttpContextBase和RouteData對象在默認情況下實際上就是RequestContext的核心組成部分
返回目錄
編輯推薦
ASP
Microsoft
Java程序性能優化
Visual C++音頻/視頻技術開發與實戰
From:http://tw.wingwit.com/Article/program/net/201311/16100.html