Пример #1
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...
     }
 }
Пример #2
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...
            }
        }