public static ServiceChannelFactory BuildChannelFactory(ChannelBuilder channelBuilder, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime) { if (channelBuilder.CanBuildChannelFactory <IDuplexChannel>()) { return(new ServiceChannelFactoryOverDuplex(channelBuilder.BuildChannelFactory <IDuplexChannel>(), clientRuntime, channelBuilder.Binding)); } if (channelBuilder.CanBuildChannelFactory <IDuplexSessionChannel>()) { return(new ServiceChannelFactoryOverDuplexSession(channelBuilder.BuildChannelFactory <IDuplexSessionChannel>(), clientRuntime, channelBuilder.Binding, false)); } return(new ServiceChannelFactoryOverRequestSession(channelBuilder.BuildChannelFactory <IRequestSessionChannel>(), clientRuntime, channelBuilder.Binding, false)); }
// special overload for security only public static ServiceChannelFactory BuildChannelFactory(ChannelBuilder channelBuilder, ClientRuntime clientRuntime) { if (channelBuilder.CanBuildChannelFactory <IDuplexChannel>()) { return(new ServiceChannelFactoryOverDuplex(channelBuilder.BuildChannelFactory <IDuplexChannel>(), clientRuntime, channelBuilder.Binding)); } else if (channelBuilder.CanBuildChannelFactory <IDuplexSessionChannel>()) { return(new ServiceChannelFactoryOverDuplexSession(channelBuilder.BuildChannelFactory <IDuplexSessionChannel>(), clientRuntime, channelBuilder.Binding, false)); } else { return(new ServiceChannelFactoryOverRequestSession(channelBuilder.BuildChannelFactory <IRequestSessionChannel>(), clientRuntime, channelBuilder.Binding, false)); } }