BindingElement.CanBuildChannelFactory<TChannel>(BindingContext) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
バインディング要素が特定の種類のチャネルのチャネル ファクトリを構築できるかどうかを示す値を返します。
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 。
返品
true
IChannelFactory<TChannel>型のTChannelをバインド要素でビルドできる場合は。それ以外の場合はfalse。
例外
context は nullです。
例
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 を呼び出してチャネル ファクトリをビルドし、ビルドできない場合に生成された例外をキャッチします。