Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the ChannelFactoryEntry class.
        /// </summary>
        /// <param name="descriptor">The endpoint descriptor for the cached channel entry.</param>
        public ChannelFactoryEntry(EndpointDescriptor descriptor)
        {
            if (descriptor == null)
            {
                throw new ArgumentNullException("descriptor");
            }

            _descriptor = descriptor;

            _channelFactory = new ChannelFactory <TChannel>(descriptor.Binding, descriptor.EndpointAddress);

            DataphorServiceUtility.ServiceEndpointHook(_channelFactory.Endpoint);

            _channelFactory.Open();
        }
Esempio n. 2
0
        public void Open()
        {
            if (!IsActive)
            {
                if (!String.IsNullOrEmpty(_clientConfigurationName))
                {
                    _channelFactory = new ChannelFactory <IClientDataphorService>(_clientConfigurationName);
                }
                else
                {
                    if (_overridePortNumber == 0)
                    {
                        Uri uri = new Uri(ListenerFactory.GetInstanceURI(_hostName, _overrideListenerPortNumber, _instanceName));
                        _channelFactory =
                            new ChannelFactory <IClientDataphorService>
                            (
                                DataphorServiceUtility.GetBinding(),
                                new EndpointAddress(uri, DataphorServiceUtility.BuildEndpointIdentityCall())
                            );
                    }
                    else
                    {
                        _channelFactory =
                            new ChannelFactory <IClientDataphorService>
                            (
                                DataphorServiceUtility.GetBinding(),
                                new EndpointAddress
                                (
                                    new Uri(DataphorServiceUtility.BuildInstanceURI(_hostName, _overridePortNumber, _instanceName)),
                                    DataphorServiceUtility.BuildEndpointIdentityCall()
                                )
                            );
                    }
                }

                DataphorServiceUtility.ServiceEndpointHook(_channelFactory.Endpoint);
            }
        }