ServiceContractGenerationContext Sınıf

Tanım

GenerateContract(ServiceContractGenerationContext) Kod oluşturmadan önce hizmet sözleşmesinin ve bağlamının değiştirilmesini etkinleştirmek için yöntemine geçirilir.

public ref class ServiceContractGenerationContext
public class ServiceContractGenerationContext
type ServiceContractGenerationContext = class
Public Class ServiceContractGenerationContext
Devralma
ServiceContractGenerationContext

Örnekler

Aşağıdaki örnekte, özel WSDL öğelerinden ayıklanan kod açıklamalarını eklemek için yöntemine geçirilen IServiceContractGenerationExtension.GenerateContract nesnenin kullanımı ServiceContractGenerationContext gösterilmektedir.

public void GenerateContract(ServiceContractGenerationContext context)
{
  Console.WriteLine("In generate contract.");
  context.ContractType.Comments.AddRange(Formatter.FormatComments(commentText));
}

Aşağıdaki kod örneği, sonuçta elde edilen kod açıklamalarını gösterir.

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

Açıklamalar

ServiceContractGenerationContext Kod oluşturmadan önce kod belgesi nesne modelini değiştirmek için yöntemine geçirilen IServiceContractGenerationExtension.GenerateContract nesnesini kullanın. Genellikle arabirim, System.ServiceModel.Description.IServiceContractGenerationExtension özel System.ServiceModel.Description.IWsdlImportExtension WSDL öğelerini içeri aktarmak veya kodu hizmet veya işlem düzeyinde başka bir şekilde değiştirmek için kullanılan özel bir uygulamada uygulanır. kodu işlem düzeyinde değiştirmek için bkz System.ServiceModel.Description.IOperationContractGenerationExtension. .

Oluşturucular

ServiceContractGenerationContext(ServiceContractGenerator, ContractDescription, CodeTypeDeclaration)

Belirtilen sözleşme oluşturucu, sözleşme açıklaması ve sözleşme kodu türü bildirimini kullanarak sınıfının yeni bir örneğini ServiceContractGenerationContext başlatır.

ServiceContractGenerationContext(ServiceContractGenerator, ContractDescription, CodeTypeDeclaration, CodeTypeDeclaration)

Belirtilen sözleşme oluşturucu, sözleşme açıklaması ve sözleşme kodu türü bildirimini kullanarak sınıfının yeni bir örneğini ServiceContractGenerationContext başlatır.

Özellikler

Contract

Geçerli sözleşmenin öğesini ContractDescription alır.

ContractType

Geçerli sözleşmenin öğesini CodeTypeDeclaration alır.

DuplexCallbackType

Hizmet sözleşmesinde CodeTypeDeclaration çift yönlü geri çağırma sözleşmesi için öğesini alır.

Operations

Sözleşme işlemlerini temsil eden nesne koleksiyonunu OperationContractGenerationContext alır.

ServiceContractGenerator

Sözleşmeyi ServiceContractGenerator oluşturmak için olan öğesini alır.

Yöntemler

Equals(Object)

Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.

(Devralındığı yer: Object)
GetHashCode()

Varsayılan karma işlevi işlevi görür.

(Devralındığı yer: Object)
GetType()

Type Geçerli örneğini alır.

(Devralındığı yer: Object)
MemberwiseClone()

Geçerli Objectöğesinin sığ bir kopyasını oluşturur.

(Devralındığı yer: Object)
ToString()

Geçerli nesneyi temsil eden dizeyi döndürür.

(Devralındığı yer: Object)

Şunlara uygulanır