public void ProcessRequest(String url, RequestParameters parameters, String verb) { RouteData routeData = RouteTable.Routes.GetRouteData(url); if (routeData != null) { if (ContinueProcessing(url, verb)) { String controllerName = routeData.GetRequiredString("Controller"); IController controller = _controllerFactory.CreateController(controllerName); if (controller != null) { var context = new RequestContext(url, routeData, this, verb); if (parameters != null) { foreach (var item in parameters) { if (context.RouteData.Values.ContainsKey(item.Key)) context.RouteData.Values[item.Key] = item.Value; else context.RouteData.Values.Add(item.Key, item.Value); } } controller.Execute(context); } } } }
public ControllerContext(IController controller, RequestContext requestContext, RouteData routeData) { Requires.NotNull(controller, "controller"); Requires.NotNull(requestContext, "requestContext"); Requires.NotNull(routeData, "routeData"); _controller = controller; _requestContext = requestContext; _routeData = routeData; }
public void Execute(RequestContext context) { _controllerContext = new ControllerContext(this, context, context.RouteData); Execute(); }