Share via


ReliableSessionBindingElement.CanBuildChannelListener<TChannel> 方法

定义

返回一个值,该值指示是否可以为能够支持可靠会话的通道和所提供的上下文生成通道侦听器。

public:
generic <typename TChannel>
 where TChannel : class, System::ServiceModel::Channels::IChannel override bool CanBuildChannelListener(System::ServiceModel::Channels::BindingContext ^ context);
public override bool CanBuildChannelListener<TChannel> (System.ServiceModel.Channels.BindingContext context) where TChannel : class, System.ServiceModel.Channels.IChannel;
override this.CanBuildChannelListener : System.ServiceModel.Channels.BindingContext -> bool (requires 'Channel : null and 'Channel :> System.ServiceModel.Channels.IChannel)
Public Overrides Function CanBuildChannelListener(Of TChannel As {Class, IChannel}) (context As BindingContext) As Boolean

类型参数

TChannel

通道 IChannel 侦听器(如果生成)接受的 。

参数

context
BindingContext

BindingContext,包含生成侦听器所需的信息,这些侦听器可接受类型为 TChannel 的通道。

返回

如果绑定元素可以生成能产生类型为 trueChannelListenerBase<TChannel>IChannel,则为 TChannel;否则为 false

注解

通道堆栈通常是使用工厂模式创建的,在这种模式中,绑定创建通道堆栈。 发送消息时,使用绑定可生成通道工厂,而通道工厂可创建通道堆栈,并返回对堆栈中顶部通道的引用。 之后,应用程序可以使用此通道发送消息。 同样在接收消息时,使用绑定可生成通道侦听器,用于侦听传入消息。 通道侦听器会通过创建通道堆栈并向应用程序传递对顶部通道的引用,将消息提供给侦听应用程序。

此方法会根据 true 中提供的值列表,对 false 返回 TChannelBuildChannelListener<TChannel>(BindingContext)

适用于