XmlSerializerOperationBehavior XmlSerializerOperationBehavior XmlSerializerOperationBehavior XmlSerializerOperationBehavior Class

定義

操作に関連付けられている XmlSerializer のランタイム動作を制御します。Controls run-time behavior of the XmlSerializer associated with an operation.

public ref class XmlSerializerOperationBehavior : System::ServiceModel::Description::IOperationBehavior, System::ServiceModel::Description::IWsdlExportExtension
public class XmlSerializerOperationBehavior : System.ServiceModel.Description.IOperationBehavior, System.ServiceModel.Description.IWsdlExportExtension
type XmlSerializerOperationBehavior = class
    interface IOperationBehavior
    interface IWsdlExportExtension
Public Class XmlSerializerOperationBehavior
Implements IOperationBehavior, IWsdlExportExtension
継承
XmlSerializerOperationBehaviorXmlSerializerOperationBehaviorXmlSerializerOperationBehaviorXmlSerializerOperationBehavior
実装

次の例では、特定の操作の XmlSerializerOperationBehavior を検索し、シリアライザーの StyleXmlSerializerFormatAttribute プロパティを設定します。The following example finds the XmlSerializerOperationBehavior for a specific operation, and sets the Style property of the XmlSerializerFormatAttribute for the serializer.

private void Run()
{
    WSHttpBinding b = new WSHttpBinding(SecurityMode.Message);
    Uri baseAddress = new Uri("http://localhost:1066/calculator");
    ServiceHost sh = new ServiceHost(typeof(Calculator), baseAddress);
    sh.AddServiceEndpoint(typeof(ICalculator), b, "");

    // Find the ContractDescription of the operation to find.
    ContractDescription cd = sh.Description.Endpoints[0].Contract;
    OperationDescription myOperationDescription = cd.Operations.Find("Add");

    // Find the serializer behavior.
    XmlSerializerOperationBehavior  serializerBehavior =
        myOperationDescription.Behaviors.
           Find<XmlSerializerOperationBehavior>();

    // If the serializer is not found, create one and add it.
    if (serializerBehavior == null)
    {
        serializerBehavior = new XmlSerializerOperationBehavior(myOperationDescription);
        myOperationDescription.Behaviors.Add(serializerBehavior);
    }
    
    // Change style of the serialize attribute.
    serializerBehavior.XmlSerializerFormatAttribute.Style = OperationFormatStyle.Document;
                
    sh.Open();
    Console.WriteLine("Listening");
    Console.ReadLine();
    sh.Close();
}
Private Sub Run()
	Dim b As New WSHttpBinding(SecurityMode.Message)
	Dim baseAddress As New Uri("http://localhost:1066/calculator")
	Dim sh As New ServiceHost(GetType(Calculator), baseAddress)
	sh.AddServiceEndpoint(GetType(ICalculator), b, "")

	' Find the ContractDescription of the operation to find.
	Dim cd As ContractDescription = sh.Description.Endpoints(0).Contract
	Dim myOperationDescription As OperationDescription = cd.Operations.Find("Add")

	' Find the serializer behavior.
	Dim serializerBehavior As XmlSerializerOperationBehavior = myOperationDescription.Behaviors. Find(Of XmlSerializerOperationBehavior)()

	' If the serializer is not found, create one and add it.
	If serializerBehavior Is Nothing Then
		serializerBehavior = New XmlSerializerOperationBehavior(myOperationDescription)
		myOperationDescription.Behaviors.Add(serializerBehavior)
	End If

	' Change style of the serialize attribute.
	serializerBehavior.XmlSerializerFormatAttribute.Style = OperationFormatStyle.Document

	sh.Open()
	Console.WriteLine("Listening")
	Console.ReadLine()
	sh.Close()
End Sub

注釈

XmlSerializerOperationBehavior を使用して、XmlSerializerStyle プロパティなどの XmlSerializerFormatAttribute オプションを制御できます。The XmlSerializerOperationBehavior enables control of XmlSerializer options, such as the Style property of the XmlSerializerFormatAttribute.

コンストラクター

XmlSerializerOperationBehavior(OperationDescription) XmlSerializerOperationBehavior(OperationDescription) XmlSerializerOperationBehavior(OperationDescription) XmlSerializerOperationBehavior(OperationDescription)

指定した操作を使用して、XmlSerializerOperationBehavior クラスの新しいインスタンスを初期化します。Initializes a new instance of the XmlSerializerOperationBehavior class with a specific operation.

XmlSerializerOperationBehavior(OperationDescription, XmlSerializerFormatAttribute) XmlSerializerOperationBehavior(OperationDescription, XmlSerializerFormatAttribute) XmlSerializerOperationBehavior(OperationDescription, XmlSerializerFormatAttribute) XmlSerializerOperationBehavior(OperationDescription, XmlSerializerFormatAttribute)

XmlSerializerOperationBehavior クラスの新しいインスタンスを初期化します。Initializes a new instance of the XmlSerializerOperationBehavior class.

プロパティ

XmlSerializerFormatAttribute XmlSerializerFormatAttribute XmlSerializerFormatAttribute XmlSerializerFormatAttribute

SOAP の使用およびフォーマットのオプションを保持するオブジェクトを取得します。Gets the object that holds SOAP use and format options.

メソッド

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

指定したオブジェクトが、現在のオブジェクトと等しいかどうかを判断します。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

既定のハッシュ関数として機能します。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

現在のインスタンスの Type を取得します。Gets the Type of the current instance.

(Inherited from Object)
GetXmlMappings() GetXmlMappings() GetXmlMappings() GetXmlMappings()

XML スキーマ要素と CLR データ型間のマッピングのコレクションを取得します。Gets the collection of mappings between XML schema elements and CLR data types.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

現在のオブジェクトを表す文字列を返します。Returns a string that represents the current object.

(Inherited from Object)

明示的なインターフェイスの実装

IOperationBehavior.AddBindingParameters(OperationDescription, BindingParameterCollection) IOperationBehavior.AddBindingParameters(OperationDescription, BindingParameterCollection) IOperationBehavior.AddBindingParameters(OperationDescription, BindingParameterCollection) IOperationBehavior.AddBindingParameters(OperationDescription, BindingParameterCollection)

操作の説明にパラメーターのセットを追加します。Adds a set of parameters to an operation description.

IOperationBehavior.ApplyClientBehavior(OperationDescription, ClientOperation) IOperationBehavior.ApplyClientBehavior(OperationDescription, ClientOperation) IOperationBehavior.ApplyClientBehavior(OperationDescription, ClientOperation) IOperationBehavior.ApplyClientBehavior(OperationDescription, ClientOperation)

クライアントの動作を操作に適用します。Applies a client's behavior to the operation.

IOperationBehavior.ApplyDispatchBehavior(OperationDescription, DispatchOperation) IOperationBehavior.ApplyDispatchBehavior(OperationDescription, DispatchOperation) IOperationBehavior.ApplyDispatchBehavior(OperationDescription, DispatchOperation) IOperationBehavior.ApplyDispatchBehavior(OperationDescription, DispatchOperation)

ディスパッチ動作を操作に適用します。Applies a dispatch behavior to the operation.

IOperationBehavior.Validate(OperationDescription) IOperationBehavior.Validate(OperationDescription) IOperationBehavior.Validate(OperationDescription) IOperationBehavior.Validate(OperationDescription)

操作を検証します。Validates the operation.

IWsdlExportExtension.ExportContract(WsdlExporter, WsdlContractConversionContext) IWsdlExportExtension.ExportContract(WsdlExporter, WsdlContractConversionContext) IWsdlExportExtension.ExportContract(WsdlExporter, WsdlContractConversionContext) IWsdlExportExtension.ExportContract(WsdlExporter, WsdlContractConversionContext)

操作のデータを WSDL ドキュメントとしてエクスポートします。Exports the operation data as a WSDL document.

IWsdlExportExtension.ExportEndpoint(WsdlExporter, WsdlEndpointConversionContext) IWsdlExportExtension.ExportEndpoint(WsdlExporter, WsdlEndpointConversionContext) IWsdlExportExtension.ExportEndpoint(WsdlExporter, WsdlEndpointConversionContext) IWsdlExportExtension.ExportEndpoint(WsdlExporter, WsdlEndpointConversionContext)

エンドポイントのデータを WSDL ドキュメントとしてエクスポートします。Exports the endpoint data as a WSDL document.

適用対象

こちらもご覧ください