.NET Framework クラス ライブラリ
ServiceEndpoint..::.Behaviors プロパティ

更新 : 2007 年 11 月

サービス エンドポイントの動作を取得します。

名前空間 :  System.ServiceModel.Description
アセンブリ :  System.ServiceModel (System.ServiceModel.dll 内)
構文

Visual Basic (宣言)
Public ReadOnly Property Behaviors As KeyedByTypeCollection(Of IEndpointBehavior)
Visual Basic (使用法)
Dim instance As ServiceEndpoint
Dim value As KeyedByTypeCollection(Of IEndpointBehavior)

value = instance.Behaviors
C#
public KeyedByTypeCollection<IEndpointBehavior> Behaviors { get; }
Visual C++
public:
property KeyedByTypeCollection<IEndpointBehavior^>^ Behaviors {
    KeyedByTypeCollection<IEndpointBehavior^>^ get ();
}
J#
/** @property */
public KeyedByTypeCollection<IEndpointBehavior> get_Behaviors()
JScript
public function get Behaviors () : KeyedByTypeCollection<IEndpointBehavior>

プロパティ値

型 : System.Collections.Generic..::.KeyedByTypeCollection<(Of <(IEndpointBehavior>)>)
サービス エンドポイントに指定された動作を含む IEndpointBehavior 型の KeyedByTypeCollection<(Of <(TItem>)>)
解説

説明階層からアクセスできる動作の型は、特定のレベルに限定されます。ServiceEndpoint から、IEndpointBehavior にアクセスできます。

エンドポイントに関連付けられた IContractBehavior にアクセスする場合は、Contract プロパティを使用してエンドポイントのコントラクトを取得します。次に、Behaviors プロパティを呼び出して、エンドポイントに関連付けられている IContractBehavior オブジェクトの KeyedByTypeCollection<(Of <(TItem>)>) を取得します。


カスタム エンドポイント動作を追加し、その動作にアクセスする方法を次のコードに示します。

C#
Uri baseAddress = new Uri("http://localhost:8001/Simple");
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

ServiceEndpoint endpoint = serviceHost.AddServiceEndpoint(
    typeof(ICalculator),
    new WSHttpBinding(),
    "CalculatorServiceObject");

endpoint.Behaviors.Add(new MyEndpointBehavior());

Console.WriteLine("List all behaviors:");
foreach (IEndpointBehavior behavior in endpoint.Behaviors)
{
    Console.WriteLine("Behavior: {0}", behavior.ToString());
}
アクセス許可

  • 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。
プラットフォーム

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
バージョン情報

.NET Framework

サポート対象 : 3.5、3.0
参照

参照

タグ :


Page view tracker