// This method is only useful if you are in a single domain Application public static IRoute FindNamedRouteWith <TController>(this IExpressiveReverseRouter router, string name, params object[] objects) where TController : IRenderingController { var func = Create <TController>((x, y, z) => x.Execute(y, z)); var mce = (MethodCallExpression)func.Body; var arguments = mce.Arguments.ToList(); var argumentTypes = mce.Arguments.Select(x => x.Type).ToList(); objects.Select(x => x.GetType()).ForAll(argumentTypes.Add); objects.Select(Expression.Constant).ForAll(arguments.Add); var controllerType = typeof(TController); var method = controllerType.GetMethod(name, argumentTypes.ToArray()); if (method == null) { return(null); } var call = Expression.Call(mce.Object, method, arguments); var newCall = Expression.Lambda(call, func.Parameters); var result = router.For <TController>() .With((Expression <Func <TController, IHttpContext, List <PositionedResult>, IResult> >)newCall); return(CoalesceRoute(result)); }
// This method is only useful if you are in a single domain Application public static IRoute FindRouteWith <TController>(this IExpressiveReverseRouter router, params object[] objects) where TController : IRenderingController { return(router.FindNamedRouteWith <TController>("Execute", objects)); }
// This method is only useful if you are in a single domain Application public static IRoute FindNamedRoute <TController>(this IExpressiveReverseRouter router, string name) where TController : IRenderingController { return(router.FindNamedRouteWith <TController>(name, new object[0])); }
// This method is only useful if you are in a single domain Application public static IRoute FindRoute <TController>(this IExpressiveReverseRouter router) where TController : IRenderingController { return(CoalesceRoute(router.For <TController>())); }