private void AddDemuxerBindingElement(BindingElementCollection elements) { if (elements.Find <ChannelDemuxerBindingElement>() == null) { TransportBindingElement item = elements.Find <TransportBindingElement>(); if (item == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("TransportBindingElementNotFound"))); } elements.Insert(elements.IndexOf(item), new ChannelDemuxerBindingElement(true)); } }
void AddDemuxerBindingElement(BindingElementCollection elements) { if (elements.Find <ChannelDemuxerBindingElement>() == null) { // add the channel demuxer binding element right above the transport TransportBindingElement transport = elements.Find <TransportBindingElement>(); if (transport == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.TransportBindingElementNotFound))); } // cache the context state in the demuxer so that the same context state can be provided to the transport // when building auxilliary channels and listeners (for ex, for security negotiation) elements.Insert(elements.IndexOf(transport), new ChannelDemuxerBindingElement(true)); } }