NamedPipeTransportBindingElement.BuildChannelFactory<TChannel> 方法

定义

创建指定类型的可用于创建通道的通道工厂。

public:
generic <typename TChannel>
 override System::ServiceModel::Channels::IChannelFactory<TChannel> ^ BuildChannelFactory(System::ServiceModel::Channels::BindingContext ^ context);
public override System.ServiceModel.Channels.IChannelFactory<TChannel> BuildChannelFactory<TChannel> (System.ServiceModel.Channels.BindingContext context);
override this.BuildChannelFactory : System.ServiceModel.Channels.BindingContext -> System.ServiceModel.Channels.IChannelFactory<'Channel>
Public Overrides Function BuildChannelFactory(Of TChannel) (context As BindingContext) As IChannelFactory(Of TChannel)

类型参数

TChannel

要创建的通道工厂的类型。

参数

context
BindingContext

一些成员,描述创建通道工厂所需的绑定、行为、协定和其他信息。

返回

IChannelFactory<TChannel>

返回指定类型的通道工厂。

例外

context 不能为 null

传递的自变量无效。

示例

此示例演示如何创建指定类型的可用于创建通道的通道工厂:

BindingContext bContext = new BindingContext(customBinding, bpCollection);
IChannelFactory<IOutputChannel> factory =
    binding.BuildChannelFactory<IOutputChannel>(bContext);
Dim bContext As New BindingContext(customBinding, bpCollection)
Dim factory As IChannelFactory(Of IOutputChannel) = binding.BuildChannelFactory(Of IOutputChannel)(bContext)

注解

此方法可用于创建指定类型的通道工厂,以基于传输绑定元素的配置发送消息。

适用于