Export (0) Print
Expand All
Expand Minimize

CodeGenerationOptions Enumeration

Specifies various options to use when generating .NET Framework types for use with an XML Web Service.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

Namespace:  System.Xml.Serialization
Assembly:  System.Xml (in System.Xml.dll)

[FlagsAttribute]
public enum CodeGenerationOptions

Member nameDescription
EnableDataBindingEnables data binding.
GenerateNewAsyncCreates events for the asynchronous invocation of Web methods.
GenerateOldAsyncCreates Begin and End methods for the asynchronous invocation of Web methods.
GenerateOrderGenerates explicitly ordered serialization code as specified through the Order property of the XmlAnyElementAttribute, XmlArrayAttribute, and XmlElementAttribute attributes.
GeneratePropertiesRepresents primitive types by properties.
NoneRepresents primitive types by fields and primitive types by System namespace types.

A Web Service Description Language (WSDL) file typically describes a class in XML schema language as an xsd:complex type composed of various primitive xsd:complex and xsd:simple types. When generating a .NET Framework class that represents a given xsd:complex type, you must choose how to represent the various primitive types it contains.

By default, each primitive is implemented as a field. If you specify the GenerateProperties option, each primitive type is instead implemented as a property.

The GenerateOrder member instructs the code generator to create the serialization code in a specific order as determined by the Order property of the following attributes:

NoteNote

Once the Order property has been set on one public property or field in a type, it must be applied to all public properties and fields for that type and all inherited types.

The following example illustrates the use of the CodeGenerationOptions enumeration to specify the behavior of a ServiceDescriptionImporter object.

// Generate properties to represent primitive values.
importer.CodeGenerationOptions = System.Xml.Serialization.CodeGenerationOptions.GenerateProperties;

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft