Beispiel #1
0
        public ActionDescriptorCreator FindAction(ControllerContext controllerContext, string actionName)
        {
            if (controllerContext == null)
            {
                throw Error.ArgumentNull("controllerContext");
            }

            if (controllerContext.RouteData != null)
            {
                MethodInfo target = controllerContext.RouteData.GetTargetActionMethod();
                if (target != null)
                {
                    // short circuit the selection process if a direct route was matched.
                    return(GetActionDescriptorDelegate(target));
                }
            }

            List <MethodInfo> finalMethods = ActionMethodSelector.FindActionMethods(controllerContext, actionName, AliasedMethods, NonAliasedMethods);

            switch (finalMethods.Count)
            {
            case 0:
                return(null);

            case 1:
                MethodInfo entryMethod = finalMethods[0];
                return(GetActionDescriptorDelegate(entryMethod));

            default:
                throw CreateAmbiguousActionMatchException(finalMethods, actionName);
            }
        }
        public ActionDescriptorCreator FindAction(ControllerContext controllerContext, string actionName)
        {
            List <MethodInfo> finalMethods = ActionMethodSelector.FindActionMethods(controllerContext, actionName, AliasedMethods, NonAliasedMethods);

            switch (finalMethods.Count)
            {
            case 0:
                return(null);

            case 1:
                MethodInfo entryMethod = finalMethods[0];
                return(GetActionDescriptorDelegate(entryMethod));

            default:
                throw CreateAmbiguousActionMatchException(finalMethods, actionName);
            }
        }