OperationContractGenerationContext Klas

Definitie

Doorgegeven aan de GenerateOperation(OperationContractGenerationContext) methode om het wijzigen van een bewerkingscontract en de bijbehorende context in te schakelen voordat code wordt gegenereerd.

public ref class OperationContractGenerationContext
public class OperationContractGenerationContext
type OperationContractGenerationContext = class
Public Class OperationContractGenerationContext
Overname
OperationContractGenerationContext

Voorbeelden

In het volgende voorbeeld ziet u het gebruik van het OperationContractGenerationContext object dat is doorgegeven aan de IOperationContractGenerationExtension.GenerateOperation methode om codeopmerkingen toe te voegen die zijn geëxtraheerd uit aangepaste WSDL-elementen.

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

In het volgende codevoorbeeld ziet u de resulterende codeopmerkingen.

/// 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

Opmerkingen

Gebruik het OperationContractGenerationContext object dat is doorgegeven aan de IOperationContractGenerationExtension.GenerateOperation methode om het codedocumentobjectmodel te wijzigen vóór het genereren van code. Normaal gesproken wordt de System.ServiceModel.Description.IOperationContractGenerationExtension interface geïmplementeerd in een aangepaste System.ServiceModel.Description.IWsdlImportExtension implementatie die wordt gebruikt om aangepaste WSDL-elementen te importeren of de code op service- of bewerkingsniveau te wijzigen. Als u de code op serviceniveau wilt wijzigen, raadpleegt System.ServiceModel.Description.IServiceContractGenerationExtensionu .

Constructors

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

Initialiseert een nieuw exemplaar van de OperationContractGenerationContext klasse met behulp van de opgegeven contractgenerator, contractcontext, beschrijving van de bewerking, declaratie van codetypen, synchronisatiemethode, beginmethode, eindmethode en taakmethode.

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

Initialiseert een nieuw exemplaar van de OperationContractGenerationContext klasse.

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

Initialiseert een nieuw exemplaar van de OperationContractGenerationContext klasse met behulp van de opgegeven contractgenerator, contractcontext, beschrijving van de bewerking, declaratie van het codetype en de methode.

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

Initialiseert een nieuw exemplaar van de OperationContractGenerationContext klasse met behulp van de opgegeven contractgenerator, contractcontext, beschrijving van de bewerking, declaratie van codetypen, synchronisatiemethode en taakmethode.

Eigenschappen

Name Description
BeginMethod

Hiermee haalt u de CodeMemberMethod asynchrone beginbewerking op.

Contract

Hiermee haalt u de context voor het genereren van code voor het servicecontract op.

DeclaringType

Hiermee haalt u het declaratietype voor de huidige bewerking op.

EndMethod

Hiermee haalt u de asynchrone eindbewerkingsdeclaratie op.

IsAsync

Hiermee wordt een waarde opgehaald die aangeeft of asynchrone methoden worden gegenereerd voor de huidige bewerking.

IsTask

Hiermee wordt een waarde opgehaald die aangeeft of een taak wordt gegenereerd voor de huidige bewerking.

Operation

Hiermee haalt u de OperationDescription voor de huidige bewerking op.

ServiceContractGenerator

Hiermee wordt de ServiceContractGenerator huidige bewerking gegenereerd.

SyncMethod

Hiermee haalt u de CodeMemberMethod voor de synchrone bewerking op.

TaskMethod

Hiermee haalt u de CodeMemberMethod taakbewerking op.

Methoden

Name Description
Equals(Object)

Bepaalt of het opgegeven object gelijk is aan het huidige object.

(Overgenomen van Object)
GetHashCode()

Fungeert als de standaardhashfunctie.

(Overgenomen van Object)
GetType()

Hiermee haalt u de Type huidige instantie op.

(Overgenomen van Object)
MemberwiseClone()

Hiermee maakt u een ondiepe kopie van de huidige Object.

(Overgenomen van Object)
ToString()

Retourneert een tekenreeks die het huidige object vertegenwoordigt.

(Overgenomen van Object)

Van toepassing op