public static TChannel CreateChannel(InstanceContext callbackInstance, Binding binding, EndpointAddress endpointAddress, Uri via)
        {
            TChannel channel = new DuplexChannelFactory <TChannel>(callbackInstance, binding).CreateChannel(endpointAddress, via);

            ChannelFactory <TChannel> .SetFactoryToAutoClose(channel);

            return(channel);
        }
        public static TChannel CreateChannel(InstanceContext callbackInstance, string endpointConfigurationName)
        {
            TChannel channel = new DuplexChannelFactory <TChannel>(callbackInstance, endpointConfigurationName).CreateChannel();

            ChannelFactory <TChannel> .SetFactoryToAutoClose(channel);

            return(channel);
        }
        public static TChannel CreateChannel(Binding binding, EndpointAddress endpointAddress, Uri via)
        {
            ChannelFactory <TChannel> factory = new ChannelFactory <TChannel>(binding);

            if (factory.HasDuplexOperations())
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SFxInvalidStaticOverloadCalledForDuplexChannelFactory1", new object[] { factory.channelType.Name })));
            }
            TChannel channel = factory.CreateChannel(endpointAddress, via);

            ChannelFactory <TChannel> .SetFactoryToAutoClose(channel);

            return(channel);
        }
        protected static TChannel CreateChannel(string endpointConfigurationName)
        {
            ChannelFactory <TChannel> factory = new ChannelFactory <TChannel>(endpointConfigurationName);

            if (factory.HasDuplexOperations())
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SFxInvalidStaticOverloadCalledForDuplexChannelFactory1", new object[] { factory.channelType.Name })));
            }
            TChannel channel = factory.CreateChannel();

            ChannelFactory <TChannel> .SetFactoryToAutoClose(channel);

            return(channel);
        }