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 オブジェクトを使用して、コードの生成前に Code Document Object Model を変更できます。 通常、System.ServiceModel.Description.IOperationContractGenerationExtension インターフェイスは、System.ServiceModel.Description.IWsdlImportExtension のカスタム実装に実装されます。このカスタム実装は、カスタム WSDL 要素をインポート、または他の方法によってサービス レベルまたは操作レベルでコードを変更するために使用されます。 サービス レベルでのコードを変更する方法については、System.ServiceModel.Description.IServiceContractGenerationExtension のトピックを参照してください。

コンストラクター

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

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

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

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

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

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

OperationContractGenerationContext(ServiceContractGenerator, ServiceContractGenerationContext, OperationDescription, CodeTypeDeclaration, CodeMemberMethod, CodeMemberMethod, CodeMemberMethod, 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)

適用対象