protected ChannelBase(ClientBase <T> client)
            {
                if (client.Endpoint.Address == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SFxChannelFactoryEndpointAddressUri")));
                }
                ChannelFactory <T> channelFactory = client.ChannelFactory;

                channelFactory.EnsureOpened();
                this.channel = channelFactory.ServiceChannelFactory.CreateServiceChannel(client.Endpoint.Address, client.Endpoint.Address.Uri);
                this.channel.InstanceContext = channelFactory.CallbackInstance;
                this.runtime = this.channel.ClientRuntime.GetRuntime();
            }
Ejemplo n.º 2
0
            protected ChannelBase(ClientBase <T> client)
            {
                if (client.Endpoint.Address == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.SFxChannelFactoryEndpointAddressUri));
                }

                ChannelFactory <T> cf = client.ChannelFactory;

                cf.EnsureOpened();  // to prevent the NullReferenceException that is thrown if the ChannelFactory is not open when cf.ServiceChannelFactory is accessed.
                _channel = cf.ServiceChannelFactory.CreateServiceChannel(client.Endpoint.Address, client.Endpoint.Address.Uri);
                _channel.InstanceContext = cf.CallbackInstance;
                _runtime = _channel.ClientRuntime.GetRuntime();
            }