CodeGenerationOptions Enum
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specifies various options to use when generating .NET types for use with an XML Web Service.
This enumeration supports a bitwise combination of its member values.
public enum class CodeGenerationOptions
[System.Flags]
public enum CodeGenerationOptions
[<System.Flags>]
type CodeGenerationOptions =
Public Enum CodeGenerationOptions
- Inheritance
- Attributes
Fields
| Name | Value | Description |
|---|---|---|
| None | 0 | Represents primitive types by fields and primitive types by System namespace types. |
| GenerateProperties | 1 | Represents primitive types by properties. |
| GenerateNewAsync | 2 | Creates events for the asynchronous invocation of Web methods. |
| GenerateOldAsync | 4 | Creates Begin and End methods for the asynchronous invocation of Web methods. |
| GenerateOrder | 8 | Generates explicitly ordered serialization code as specified through the |
| EnableDataBinding | 16 | Enables data binding. |
Examples
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;
Remarks
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 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.
Ordering of serialization code
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:
Note
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.