Пример #1
0
        public static bool TryGet(Message message, out ChannelBindingMessageProperty property)
        {
            if (message == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message");
            }

            return(TryGet(message.Properties, out property));
        }
Пример #2
0
 public static void TryAddToMessage(ChannelBinding channelBindingToken, Message message, bool messagePropertyOwnsCleanup)
 {
     if (channelBindingToken != null)
     {
         ChannelBindingMessageProperty property = new ChannelBindingMessageProperty(channelBindingToken, messagePropertyOwnsCleanup);
         property.AddTo(message);
         ((IDisposable)property).Dispose(); //message.Properties.Add() creates a copy...
     }
 }
        public static bool TryGet(MessageProperties properties, out ChannelBindingMessageProperty property)
        {
            if (properties == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(properties));
            }

            property = null;

            if (properties.TryGetValue(Name, out object value))
            {
                property = value as ChannelBindingMessageProperty;
                return(property != null);
            }

            return(false);
        }
Пример #4
0
        protected override void PrepareMessage(Message message)
        {
            base.PrepareMessage(message);
            IPEndPoint remoteEndPoint = rawConnection.RemoteIPEndPoint;

            // pipes will return null
            if (remoteEndPoint != null)
            {
                RemoteEndpointMessageProperty remoteEndpointProperty = new RemoteEndpointMessageProperty(remoteEndPoint);
                message.Properties.Add(RemoteEndpointMessageProperty.Name, remoteEndpointProperty);
            }

            if (channelBindingToken != null)
            {
                ChannelBindingMessageProperty property = new ChannelBindingMessageProperty(channelBindingToken, false);
                property.AddTo(message);
                ((IDisposable)property).Dispose(); //message.Properties.Add() creates a copy...
            }
        }