Beispiel #1
0
        private void RegisterAction(Type type)
        {
            var name      = NormalizeActionName(ActionAttribute.GetName(type));
            var component = Container.EmptyComponent();

            component.Name               = name;
            component.ServiceType        = typeof(IAction);
            component.ImplementationType = type;
            component.Lifestyle          = Lifestyle.Transient;
            Container.Register(component);
            ClearCaches(MvcObjectType.Action, name);
        }
        /// <summary>
        ///     Creates new descriptor over given action
        /// </summary>
        /// <param name="action"> </param>
        public ActionDescriptor(IAction action)
        {
            Action      = action;
            Name        = ActionAttribute.GetName(action);
            DirectRole  = ActionAttribute.GetRole(action);
            Help        = ActionAttribute.GetHelp(action);
            RoleContext = ActionAttribute.GetRoleContext(action);
            Arm         = ActionAttribute.GetArm(action);
            var contextualAction = action as IContextualAction;

            if (contextualAction != null)
            {
                contextualAction.SetDescriptor(this);
            }
        }
Beispiel #3
0
 /// <summary>
 ///     В качестве суффикса возвращается имя действия
 /// </summary>
 /// <returns> </returns>
 protected override string GetLoggerNameSuffix()
 {
     return(ActionAttribute.GetName(this));
 }