XmlSerializerOperationBehavior Class
Controls run-time behavior of the XmlSerializer associated with an operation.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
| Name | Description | |
|---|---|---|
![]() | XmlSerializerOperationBehavior(OperationDescription) | Initializes a new instance of the XmlSerializerOperationBehavior class with a specific operation. |
![]() | XmlSerializerOperationBehavior(OperationDescription, XmlSerializerFormatAttribute) | Initializes a new instance of the XmlSerializerOperationBehavior class. |
| Name | Description | |
|---|---|---|
![]() | XmlSerializerFormatAttribute | Gets the object that holds SOAP use and format options. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | Finalize() | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.) |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType() | |
![]() | GetXmlMappings() | Gets the collection of mappings between XML schema elements and CLR data types. |
![]() | MemberwiseClone() | |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() ![]() | IOperationBehavior.AddBindingParameters(OperationDescription, BindingParameterCollection) | Adds a set of parameters to an operation description. |
![]() ![]() | IOperationBehavior.ApplyClientBehavior(OperationDescription, ClientOperation) | Applies a client's behavior to the operation. |
![]() ![]() | IOperationBehavior.ApplyDispatchBehavior(OperationDescription, DispatchOperation) | Applies a dispatch behavior to the operation. |
![]() ![]() | IOperationBehavior.Validate(OperationDescription) | Validates the operation. |
![]() ![]() | IWsdlExportExtension.ExportContract(WsdlExporter, WsdlContractConversionContext) | Exports the operation data as a WSDL document. |
![]() ![]() | IWsdlExportExtension.ExportEndpoint(WsdlExporter, WsdlEndpointConversionContext) | Exports the endpoint data as a WSDL document. |
The XmlSerializerOperationBehavior enables control of XmlSerializer options, such as the Style property of the XmlSerializerFormatAttribute.
The following example finds the XmlSerializerOperationBehavior for a specific operation, and sets the Style property of the XmlSerializerFormatAttribute for the serializer.
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
Available since 3.0
Silverlight
Available since 4.0
Windows Phone Silverlight
Available since 8.0
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.




