/// <summary> /// Creates a client channel sink instance. /// </summary> /// <param name="channel">Channel for which the current sink chain is being constructed.</param> /// <param name="url">The URL of the object to connect to. This parameter can be null if the connection is based entirely on the information contained in the <paramref name="remoteChannelData"/> parameter.</param> /// <param name="remoteChannelData">A channel data object that describes a channel on the remote server.</param> /// <returns> /// The first sink of the newly formed channel sink chain, or null, which indicates that this provider will not or cannot provide a connection for this endpoint. /// </returns> /// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception> public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData) { IClientChannelSink nextSink = null; if (_nextSink != null) { // Call CreateSink on the next sink provider in the chain. This will return // to us the actual next sink object. If the next sink is null, uh oh! if ((nextSink = _nextSink.CreateSink(channel, url, remoteChannelData)) == null) return null; } InitializeSerializer(); var sink = new EnvelopeClientChannelSink(nextSink, _targetApplicationName, _serializer); return sink; }