Example #1
0
        internal ActionGroupInfo(ControllerInfo controller, string actionInvocationName)
        {
            Controller = controller;
            Name       = actionInvocationName;

            var allNamedMethods = controller.GetAllActionMethods()
                                  .Where(mi => ControllerInfo.GetInvocationNames(mi).Any(n => n.EqualsIgnoreCase(actionInvocationName)));

            var actions = new List <ActionInfo>();

            foreach (var mi in allNamedMethods)
            {
                var allAtrs = mi.GetCustomAttributes <ActionBaseAttribute>(false)
                              .Where(a => a.Name.IsNullOrWhiteSpace() || a.Name.EqualsIgnoreCase(actionInvocationName));

                foreach (var atr in allAtrs)
                {
                    actions.Add(new ActionInfo(this, mi, atr));
                }
            }

            Actions = actions.OrderBy(ai => ai.Attribute.Order).ToArray();

            //warm-up for possible errors
            foreach (var ai in actions)
            {
                var matches = ai.Attribute.Matches;//cause matches script to load, and bubble exceptions if it contains any
            }
        }
Example #2
0
        internal ActionGroupInfo(ControllerInfo controller, string actionInvocationName)
        {
            Controller = controller;
            m_Name     = actionInvocationName;

            var allmi = controller.GetAllActionMethods()
                        .Where(mi => ControllerInfo.GetInvocationName(mi).Equals(actionInvocationName, StringComparison.InvariantCultureIgnoreCase));

            var actions = new List <ActionInfo>();

            foreach (var mi in allmi)
            {
                actions.Add(new ActionInfo(this, mi));
            }

            Actions = actions.OrderBy(ai => ai.Attribute.Order).ToArray();

            //warm-up for possible errors
            foreach (var ai in actions)
            {
                var matches = ai.Attribute.Matches;//cause matches script to load, and bubble exceptions if it contains any
            }
        }