BindingElement.GetProperty<T>(BindingContext) メソッド

定義

派生クラスでオーバーライドされると、バインディング スタック内の適切なレイヤーから、要求された型指定されたオブジェクト (存在する場合) を返します。

public:
generic <typename T>
 where T : class abstract T GetProperty(System::ServiceModel::Channels::BindingContext ^ context);
public abstract T GetProperty<T>(System.ServiceModel.Channels.BindingContext context) where T : class;
abstract member GetProperty : System.ServiceModel.Channels.BindingContext -> 'T (requires 'T : null)
Public MustOverride Function GetProperty(Of T As Class) (context As BindingContext) As T

型パラメーター

T

メソッドがクエリを実行する型指定されたオブジェクト。

パラメーター

context
BindingContext

バインド要素の BindingContext

返品

T

型指定されたオブジェクト T 存在する場合は要求され、存在しない場合は null されます。

CustomBinding binding = new CustomBinding();
HttpTransportBindingElement element = new HttpTransportBindingElement();
BindingParameterCollection parameters = new BindingParameterCollection();
parameters.Add(new ServiceCredentials());
Uri baseAddress = new Uri("http://localhost:8000/ChannelApp");
String relAddress = "http://localhost:8000/ChannelApp/service";
BindingContext context = new BindingContext(binding, parameters, baseAddress, relAddress, ListenUriMode.Explicit);

ServiceCredentials serviceCredentials = element.GetProperty<ServiceCredentials>(context);

注釈

これを使用して、バインディング要素スタックから機能、要件、およびパラメーターを取得します。 バインディング要素が要求されたオブジェクトの返しをサポートしている場合は、それを返します。 そうでない場合は、呼び出しをスタック内の次のバインド要素に委任します。 スタックの一番下に到達し、要求されたオブジェクトをサポートするバインド要素がない場合、メソッドは nullを返します。

Note

暗号化する必要があるメッセージ ヘッダーを追加する場合は、ChannelProtectionRequirementsを要求されたときに、このメソッドから要件を持つChannelProtectionRequirements インスタンスを返す必要があります。

適用対象