コード例 #1
0
        public bool TryGetParts(string action, bool excludeChannelScope, out MessagePartSpecification parts)
        {
            if (action == null)
            {
                action = MessageHeaders.WildcardAction;
            }
            parts = null;

            if (isReadOnly)
            {
                if (readOnlyNormalizedActionParts.ContainsKey(action))
                {
                    if (excludeChannelScope)
                    {
                        parts = actionParts[action];
                    }
                    else
                    {
                        parts = readOnlyNormalizedActionParts[action];
                    }
                }
            }
            else if (actionParts.ContainsKey(action))
            {
                MessagePartSpecification p = new MessagePartSpecification();
                p.Union(actionParts[action]);
                if (!excludeChannelScope)
                {
                    p.Union(channelParts);
                }
                parts = p;
            }

            return(parts != null);
        }
コード例 #2
0
 public void MakeReadOnly()
 {
     if (!isReadOnly)
     {
         readOnlyNormalizedActionParts = new Dictionary <string, MessagePartSpecification>();
         foreach (string action in actionParts.Keys)
         {
             MessagePartSpecification p = new MessagePartSpecification();
             p.Union(actionParts[action]);
             p.Union(channelParts);
             p.MakeReadOnly();
             readOnlyNormalizedActionParts[action] = p;
         }
         isReadOnly = true;
     }
 }
コード例 #3
0
        public ScopedMessagePartSpecification(ScopedMessagePartSpecification other)
            : this()
        {
            if (other == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException(nameof(other)));
            }

            channelParts.Union(other.channelParts);
            if (other.actionParts != null)
            {
                foreach (string action in other.actionParts.Keys)
                {
                    MessagePartSpecification p = new MessagePartSpecification();
                    p.Union(other.actionParts[action]);
                    actionParts[action] = p;
                }
            }
        }