internal ServiceChannelProxy(System.Type interfaceType, System.Type proxiedType, MessageDirection direction, ServiceChannel serviceChannel) : base(proxiedType)
 {
     if (!MessageDirectionHelper.IsDefined(direction))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("direction"));
     }
     this.interfaceType   = interfaceType;
     this.proxiedType     = proxiedType;
     this.serviceChannel  = serviceChannel;
     this.proxyRuntime    = serviceChannel.ClientRuntime.GetRuntime();
     this.methodDataCache = new MethodDataCache();
     this.objectWrapper   = new MbrObject(this, proxiedType);
 }
            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();
            }
Esempio n. 3
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();
            }