public IController CreateController(RequestContext requestContext,string controllerName)
 {
     string typeName = controllerName + "Controller";
     Type controllerType = controllerTypes.FirstOrDefault(c => string.Compare(typeName, c.Name, true) == 0);
     if (null == controllerType)
     {
         return null;
     }
     return (IController)Activator.CreateInstance(controllerType);
 }
Exemple #2
0
 protected virtual void OnPostResolveRequestCache(object sender, EventArgs e)
 {
     HttpContextWrapper httpContext = new HttpContextWrapper(HttpContext.Current);
     RouteData routeData = RouteTable.Routes.GetRouteData(httpContext);
     if (null == routeData)
     {
         return;
     }
     RequestContext requestContext = new RequestContext
     {
         RouteData = routeData,
         HttpContext = httpContext
     };
     IHttpHandler handler = routeData.RouteHandler.GetHttpHandler(requestContext);
     httpContext.RemapHandler(handler);
 }
Exemple #3
0
 public MvcHandler(RequestContext requestContext)
 {
     this.RequestContext = requestContext;
 }
Exemple #4
0
 public IHttpHandler GetHttpHandler(RequestContext requestContext)
 {
     return new MvcHandler(requestContext);
 }