BindingElement.CanBuildChannelFactory<TChannel>(BindingContext) メソッド

定義

指定した種類のチャネルに対するチャネル ファクトリをバインド要素が作成できるかどうかを示す値を返します。

public:
generic <typename TChannel>
 virtual bool CanBuildChannelFactory(System::ServiceModel::Channels::BindingContext ^ context);
public virtual bool CanBuildChannelFactory<TChannel> (System.ServiceModel.Channels.BindingContext context);
abstract member CanBuildChannelFactory : System.ServiceModel.Channels.BindingContext -> bool
override this.CanBuildChannelFactory : System.ServiceModel.Channels.BindingContext -> bool
Public Overridable Function CanBuildChannelFactory(Of TChannel) (context As BindingContext) As Boolean

型パラメーター

TChannel

チャネル ファクトリが作成するチャネルの種類。

パラメーター

context
BindingContext

バインディング要素のコンテキストを提供する BindingContext

戻り値

Boolean

true 型の IChannelFactory<TChannel> をバインディング要素によって作成できる場合は TChannel。それ以外の場合は false

例外

contextnullです。

CustomBinding binding = new CustomBinding();
HttpTransportBindingElement element = new HttpTransportBindingElement();
BindingParameterCollection parameters = new BindingParameterCollection();
BindingContext context = new BindingContext(binding, parameters);

bool bFlag = element.CanBuildChannelFactory<IRequestChannel>(context);

注釈

ファクトリを作成する前に、指定した TChannel に対して context 型のチャネルのチャネル ファクトリを作成できることを確認するには、このメソッドを使用します。 または、BuildChannelFactory を呼び出してチャネル ファクトリを作成し、作成できない場合は生成される例外をキャッチします。

適用対象