MsmqTransportBindingElement.CanBuildChannelFactory<TChannel>(BindingContext) 方法
定义
返回一个布尔值,该值指示是否能够使用提供的上下文生成通道工厂。Returns a Boolean value that indicates whether you can build a channel factory with the context provided.
public:
generic <typename TChannel>
override bool CanBuildChannelFactory(System::ServiceModel::Channels::BindingContext ^ context);
public override bool CanBuildChannelFactory<TChannel> (System.ServiceModel.Channels.BindingContext context);
override this.CanBuildChannelFactory : System.ServiceModel.Channels.BindingContext -> bool
Public Overrides Function CanBuildChannelFactory(Of TChannel) (context As BindingContext) As Boolean
类型参数
- TChannel
用于生成通道侦听器的通道类型。The channel type to be used to build the channel listener. 允许使用的通道类型为 IOutputSessionChannel 或 IOutputChannel 类。Permitted channel types are IOutputSessionChannel or a IOutputChannel class.
参数
- context
- BindingContext
用以生成通道工厂的 BindingContext。The BindingContext with which to build the channel factory.
返回
如果利用所提供的上下文可生成通道工厂,则为 true;否则为 false。true if you can build a channel factory with the context provided; otherwise, false. 仅当 true 为 TChannel 或 IOutputChannel 时,绑定元素才返回 IOutputSessionChannel。The binding element returns true only when TChannel is IOutputChannel or IOutputSessionChannel.
示例
if (transportBindingElement.CanBuildChannelFactory<IOutputChannel>(context))
{
// Do something...
}