OperationContractGenerationContext クラス

定義

コードを生成する前に操作コントラクトとそのコンテキストの変更を有効にするために、 GenerateOperation(OperationContractGenerationContext) メソッドに渡されます。

public ref class OperationContractGenerationContext
public class OperationContractGenerationContext
type OperationContractGenerationContext = class
Public Class OperationContractGenerationContext
継承
OperationContractGenerationContext

次の例は、OperationContractGenerationContext メソッドに渡されるIOperationContractGenerationExtension.GenerateOperation オブジェクトを使用して、カスタム WSDL 要素から抽出されたコード コメントを追加する方法を示しています。

public void GenerateOperation(OperationContractGenerationContext context)
{
  context.SyncMethod.Comments.AddRange(Formatter.FormatComments(commentText));
  Console.WriteLine("In generate operation.");
}

次のコード例は、結果のコード コメントを示しています。

/// From WSDL Documentation:
///
/// <summary>This contract is a stateless contract that provides a mechanism for
/// computing the nth Fibonacci term.</summary>
///
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://microsoft.wcf.documentation", ConfigurationName="IFibonacci")]
public interface IFibonacci
{

    /// From WSDL Documentation:
    ///
    /// <summary>The Compute operation returns the nth Fibonacci number.  Because it
    /// uses dual recursion it's very inefficient and therefore useful to demonstrate
    /// caching.</summary><returns>The nth Fibonacci number.</returns><param
    /// name="num">The value to use when computing the Fibonacci number.</param>
    ///
    [System.ServiceModel.OperationContractAttribute(Action="http://microsoft.wcf.documentation/IFibonacci/Compute", ReplyAction="http://microsoft.wcf.documentation/IFibonacci/ComputeResponse")]
    int Compute(int num);

    /// From WSDL Documentation:
    ///
    /// <summary>The GetPerson operation tests custom WSDL documentation
    /// generation.</summary><returns>The Person object to be returned.</returns><param
    /// name="FirstParameter">The value for the first parameter.</param><param
    /// name="SecondParameter">The value for the second parameter.</param>
    ///
    [System.ServiceModel.OperationContractAttribute(Action="http://microsoft.wcf.documentation/IFibonacci/GetPerson", ReplyAction="http://microsoft.wcf.documentation/IFibonacci/GetPersonResponse")]
    Microsoft.WCF.Documentation.Person GetPerson(int FirstParameter, int SecondParameter);
}

'''From WSDL Documentation:
'''
'''<summary>This contract is a stateless contract that provides a mechanism for 
'''computing the nth Fibonacci term.</summary> 
'''
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0"),  _
 System.ServiceModel.ServiceContractAttribute([Namespace]:="http://microsoft.wcf.documentation", ConfigurationName:="IFibonacci")>  _
Public Interface IFibonacci
    
    '''From WSDL Documentation:
    '''
    '''<summary>The Compute operation returns the nth Fibonacci number.  Because it 
    '''uses dual recursion it's very inefficient and therefore useful to demonstrate 
    '''caching.</summary><returns>The nth Fibonacci number.</returns><param 
    '''name="num">The value to use when computing the Fibonacci number.</param> 
    '''
    <System.ServiceModel.OperationContractAttribute(Action:="http://microsoft.wcf.documentation/IFibonacci/Compute", ReplyAction:="http://microsoft.wcf.documentation/IFibonacci/ComputeResponse")>  _
    Function Compute(ByVal num As Integer) As Integer
    
    '''From WSDL Documentation:
    '''
    '''<summary>The GetPerson operation tests custom WSDL documentation 
    '''generation.</summary><returns>The Person object to be returned.</returns><param 
    '''name="FirstParameter">The value for the first parameter.</param><param 
    '''name="SecondParameter">The value for the second parameter.</param> 
    '''
    <System.ServiceModel.OperationContractAttribute(Action:="http://microsoft.wcf.documentation/IFibonacci/GetPerson", ReplyAction:="http://microsoft.wcf.documentation/IFibonacci/GetPersonResponse")>  _
    Function GetPerson(ByVal FirstParameter As Integer, ByVal SecondParameter As Integer) As Microsoft.WCF.Documentation.Person
End Interface

注釈

コードの生成前にコード ドキュメント オブジェクト モデルを変更するには、OperationContractGenerationContext メソッドに渡されるIOperationContractGenerationExtension.GenerateOperation オブジェクトを使用します。 通常、 System.ServiceModel.Description.IOperationContractGenerationExtension インターフェイスは、カスタム WSDL 要素をインポートしたり、サービスレベルまたは操作レベルでコードを変更したりするために使用されるカスタム System.ServiceModel.Description.IWsdlImportExtension 実装に実装されます。 サービス レベルでコードを変更するには、 System.ServiceModel.Description.IServiceContractGenerationExtensionを参照してください。

コンストラクター

名前 説明
OperationContractGenerationContext(ServiceContractGenerator, ServiceContractGenerationContext, OperationDescription, CodeTypeDeclaration, CodeMemberMethod, CodeMemberMethod, CodeMemberMethod, CodeMemberMethod)

指定したコントラクト ジェネレーター、コントラクト コンテキスト、操作の説明、コード型宣言、同期メソッド、begin メソッド、終了メソッド、およびタスク メソッドを使用して、 OperationContractGenerationContext クラスの新しいインスタンスを初期化します。

OperationContractGenerationContext(ServiceContractGenerator, ServiceContractGenerationContext, OperationDescription, CodeTypeDeclaration, CodeMemberMethod, CodeMemberMethod, CodeMemberMethod)

OperationContractGenerationContext クラスの新しいインスタンスを初期化します。

OperationContractGenerationContext(ServiceContractGenerator, ServiceContractGenerationContext, OperationDescription, CodeTypeDeclaration, CodeMemberMethod, CodeMemberMethod)

指定したコントラクト ジェネレーター、コントラクト コンテキスト、操作の説明、コード型宣言、およびメソッドを使用して、 OperationContractGenerationContext クラスの新しいインスタンスを初期化します。

OperationContractGenerationContext(ServiceContractGenerator, ServiceContractGenerationContext, OperationDescription, CodeTypeDeclaration, CodeMemberMethod)

指定したコントラクト ジェネレーター、コントラクト コンテキスト、操作の説明、コード型宣言、同期メソッド、タスク メソッドを使用して、 OperationContractGenerationContext クラスの新しいインスタンスを初期化します。

プロパティ

名前 説明
BeginMethod

非同期開始操作の CodeMemberMethod を取得します。

Contract

サービス コントラクトのコード生成コンテキストを取得します。

DeclaringType

現在の操作の宣言型を取得します。

EndMethod

非同期の終了操作宣言を取得します。

IsAsync

現在の操作に対して非同期メソッドが生成されるかどうかを示す値を取得します。

IsTask

現在の操作に対してタスクが生成されるかどうかを示す値を取得します。

Operation

現在の操作の OperationDescription を取得します。

ServiceContractGenerator

現在の操作を生成する ServiceContractGenerator を取得します。

SyncMethod

同期操作の CodeMemberMethod を取得します。

TaskMethod

タスク操作の CodeMemberMethod を取得します。

メソッド

名前 説明
Equals(Object)

指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象