public static void TryAddToMessage(ChannelBinding channelBindingToken, Message message, bool messagePropertyOwnsCleanup) { if (channelBindingToken != null) { ChannelBindingMessageProperty property = new ChannelBindingMessageProperty(channelBindingToken, messagePropertyOwnsCleanup); property.AddTo(message); property.Dispose(); //message.Properties.Add() creates a copy... } }
protected override void PrepareMessage(Message message) { base.PrepareMessage(message); IPEndPoint remoteIPEndPoint = this.rawConnection.RemoteIPEndPoint; if (remoteIPEndPoint != null) { RemoteEndpointMessageProperty property = new RemoteEndpointMessageProperty(remoteIPEndPoint); message.Properties.Add(RemoteEndpointMessageProperty.Name, property); } if (this.channelBindingToken != null) { ChannelBindingMessageProperty property2 = new ChannelBindingMessageProperty(this.channelBindingToken, false); property2.AddTo(message); property2.Dispose(); } }