コード例 #1
0
        private void Initialize(IDictionary properties, IClientChannelSinkProvider sinkProvider)
        {
            if (properties != null)
            {
                // read property values
                foreach (DictionaryEntry property in properties)
                {
                    switch ((string)property.Key)
                    {
                    case "name": _channelName = Convert.ToString(property.Value); break;

                    case "priority": _channelPriority = Convert.ToInt32(property.Value); break;

                    case "cachedConnections": _cachedConnections = Convert.ToInt32(property.Value); break;
                    }
                }
            }

            // create the chain of the sink providers that will process all messages
            _sinkProvider = ChannelHelper.ClientChannelCreateSinkProviderChain(
                sinkProvider, new PipeClientTransportSinkProvider());

            //  create connection cache
            _connectionCache = new ConnectionCache(_cachedConnections, new ConnectionFactory(CreateConnection));
        }