Ejemplo n.º 1
0
        public static string GetGetterParameterName(this ActionDescriptor action)
        {
            if (!action.IsElementGetter())
            {
                throw new Exception("No tiene sentido obtener el parámetro marcado como GetterParameter en una action NO marcada como Getter.");
            }

            foreach (ControllerParameterDescriptor param in action.Parameters)
            {
                bool isGetterParam = param.ParameterInfo.CustomAttributes.Any(x => x.AttributeType == typeof(GetterParameterAttribute));

                if (isGetterParam)
                {
                    return(param.Name);
                }
            }

            return(null);
        }