예제 #1
0
        public void AddRole(string role, AspectDependencyPosition position)
        {
            if (ContainsRole(role))
            {
                throw new InvalidOperationException(
                          string.Format("Aspect '{0}' already defined role '{1}'",
                                        Aspect.AspectAttribute.AttributeType.Name,
                                        role));
            }

            switch (position)
            {
            case AspectDependencyPosition.Before:
                BeforeRoles.Add(role);
                break;

            case AspectDependencyPosition.Any:
                AnyRoles.Add(role);
                break;

            case AspectDependencyPosition.After:
                AfterRoles.Add(role);
                break;

            default:
                throw new ArgumentOutOfRangeException("position");
            }
        }
 public AspectRoleDependencyAttribute(
     AspectDependencyAction action,
     AspectDependencyPosition position,
     string role)
 {
     Action   = action;
     Position = position;
     Role     = role;
 }
 public AspectRoleDependencyAttribute(
     AspectDependencyAction action,
     AspectDependencyPosition position,
     string role)
 {
     Action = action;
     Position = position;
     Role = role;
 }
        public void AddRole(string role, AspectDependencyPosition position)
        {
            if (ContainsRole(role))
                throw new InvalidOperationException(
                    string.Format("Aspect '{0}' already defined role '{1}'",
                        Aspect.AspectAttribute.AttributeType.Name,
                        role));

            switch (position)
            {
                case AspectDependencyPosition.Before:
                    BeforeRoles.Add(role);
                    break;
                case AspectDependencyPosition.Any:
                    AnyRoles.Add(role);
                    break;
                case AspectDependencyPosition.After:
                    AfterRoles.Add(role);
                    break;
                default:
                    throw new ArgumentOutOfRangeException("position");
            }
        }