Example #1
0
 public string Parse(string url, out string objectUri)
 {
     if (_serverChannel != null)
     {
         return(_serverChannel.Parse(url, out objectUri));
     }
     else
     {
         return(_clientChannel.Parse(url, out objectUri));
     }
 }
        public static IMessageSink ClientChannelCreateMessageSink(
            IChannelSender channel,
            IClientChannelSinkProvider sinkProviderChain,
            string url,
            object remoteChannelData,
            out string objectUri)
        {
            objectUri = null;
            string channelUri = null;

            if (url != null)
            {
                // parse returns null if this is not one of our url's
                channelUri = channel.Parse(url, out objectUri);
            }
            else if (remoteChannelData != null)
            {
                IChannelDataStore cds = remoteChannelData as IChannelDataStore;
                if (cds != null)
                {
                    // see if this is a valid uri
                    string simpleChannelUri = channel.Parse(cds.ChannelUris[0], out objectUri);
                    if (simpleChannelUri != null)
                    {
                        channelUri = cds.ChannelUris[0];
                    }
                }
            }

            if (channelUri != null)
            {
                // create message sink
                return(sinkProviderChain.CreateSink(channel,
                                                    (url != null ? url : channelUri), remoteChannelData) as IMessageSink);
            }

            // could not connect
            return(null);
        }
		public static IMessageSink ClientChannelCreateMessageSink(
			IChannelSender channel,
			IClientChannelSinkProvider sinkProviderChain,
			string url,
			object remoteChannelData,
			out string objectUri)
		{
			objectUri = null;
			string channelUri = null;

			if (url != null)
			{
				// parse returns null if this is not one of our url's
				channelUri = channel.Parse(url, out objectUri);
			}
			else if (remoteChannelData != null)
			{
				IChannelDataStore cds = remoteChannelData as IChannelDataStore;
				if (cds != null)
				{
					// see if this is a valid uri
					string simpleChannelUri = channel.Parse(cds.ChannelUris[0], out objectUri);
					if (simpleChannelUri != null)
						channelUri = cds.ChannelUris[0];
				}
			}

			if (channelUri != null)
			{
				// create message sink
				return sinkProviderChain.CreateSink(channel,
					(url != null ? url : channelUri), remoteChannelData) as IMessageSink;
			}

			// could not connect
			return null;
		}