在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
复制代码 代码如下: MVCHandler : IHttpHandler void IHttpHandler.ProcessRequest(HttpContext httpContext) { this.ProcessRequest(httpContext); } protected virtual void ProcessRequest(HttpContext httpContext) protected internal virtual void ProcessRequest(HttpContextBase httpContext) 复制代码 代码如下: Controller : ControllerBase : IController void IController.Execute(RequestContext requestContext) //------>Controller { this.Execute(requestContext); } protected virtual void Execute(RequestContext requestContext) //------>ControllerBase protected override void ExecuteCore() //------>Controller 复制代码 代码如下: ControllerActionInvoker : IActionInvoker public virtual bool InvokeAction(ControllerContext controllerContext, string actionName) { if (controllerContext == null) { throw new ArgumentNullException("controllerContext"); } if (string.IsNullOrEmpty(actionName)) { throw new ArgumentException(MvcResources.Common_NullOrEmpty, "actionName"); } ControllerDescriptor controllerDescriptor = this.GetControllerDescriptor(controllerContext); ActionDescriptor actionDescriptor = this.FindAction(controllerContext, controllerDescriptor, actionName); if (actionDescriptor == null) { return false; } FilterInfo filters = this.GetFilters(controllerContext, actionDescriptor); try { AuthorizationContext context = this.InvokeAuthorizationFilters(controllerContext, filters.AuthorizationFilters, actionDescriptor); if (context.Result != null) { this.InvokeActionResult(controllerContext, context.Result); } else { if (controllerContext.Controller.ValidateRequest) { ValidateRequest(controllerContext); } IDictionary<string, object> parameterValues = this.GetParameterValues(controllerContext, actionDescriptor); ActionExecutedContext context2 = this.InvokeActionMethodWithFilters(controllerContext, filters.ActionFilters, actionDescriptor, parameterValues); this.InvokeActionResultWithFilters(controllerContext, filters.ResultFilters, context2.Result); } } catch (ThreadAbortException) { throw; } catch (Exception exception) { ExceptionContext context3 = this.InvokeExceptionFilters(controllerContext, filters.ExceptionFilters, exception); if (!context3.ExceptionHandled) { throw; } this.InvokeActionResult(controllerContext, context3.Result); } return true; } protected virtual void InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) 复制代码 代码如下: ActionResult public override void ExecuteResult(ControllerContext context) { if (context == null) { throw new ArgumentNullException("context"); } if (string.IsNullOrEmpty(this.ViewName)) { this.ViewName = context.RouteData.GetRequiredString("action"); } ViewEngineResult result = null; if (this.View == null) { result = this.FindView(context); //ViewEngineResult this.View = result.View; //IView接口 } TextWriter output = context.HttpContext.Response.Output; ViewContext viewContext = new ViewContext(context, this.View, this.ViewData, this.TempData, output); this.View.Render(viewContext, output); if (result != null) { result.ViewEngine.ReleaseView(context, this.View); } } |
请发表评论