public static bool TryGet(Message message, out ChannelBindingMessageProperty property) { if (message == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message"); } return(TryGet(message.Properties, out property)); }
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); }
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... } }