CodeGenerationOptions 枚举

定义

指定在生成用于 XML Web services 的 .NET 类型时使用的各种选项。Specifies various options to use when generating .NET types for use with an XML Web Service.

此枚举有一个 FlagsAttribute 属性,允许按位组合成员值。

public enum class CodeGenerationOptions
public enum CodeGenerationOptions
[System.Flags]
public enum CodeGenerationOptions
type CodeGenerationOptions = 
Public Enum CodeGenerationOptions
继承
CodeGenerationOptions
属性

字段

EnableDataBinding 16

启用数据绑定。Enables data binding.

GenerateNewAsync 2

创建异步调用 Web 方法的事件。Creates events for the asynchronous invocation of Web methods.

GenerateOldAsync 4

创建异步调用 Web 方法的 Begin 和 End 方法。Creates Begin and End methods for the asynchronous invocation of Web methods.

GenerateOrder 8

OrderXmlAnyElementAttributeXmlArrayAttribute 特性的 XmlElementAttribute 属性所指定的方式显式生成排序序列化代码。Generates explicitly ordered serialization code as specified through the Order property of the XmlAnyElementAttribute, XmlArrayAttribute, and XmlElementAttribute attributes.

GenerateProperties 1

由属性表示基元类型。Represents primitive types by properties.

None 0

由字段表示基元类型并由 System 命名空间类型表示基元类型。Represents primitive types by fields and primitive types by System namespace types.

示例

下面的示例演示如何使用 CodeGenerationOptions 枚举来指定 ServiceDescriptionImporter 对象的行为。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;
// Generate properties to represent primitive values.
importer.CodeGenerationOptions = System.Xml.Serialization.CodeGenerationOptions.GenerateProperties;

注解

Web 服务描述语言(WSDL)文件通常将 XML 架构语言的类描述为由各种基元 xsd:complexxsd:simple 类型组成的 xsd:complex 类型。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. 生成表示给定 xsd:complex 类型的 .NET 类时,必须选择如何表示它包含的各种基元类型。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. 如果指定 GenerateProperties 选项,则每个基元类型将改为作为属性实现。If you specify the GenerateProperties option, each primitive type is instead implemented as a property.

序列化代码的顺序Ordering of serialization code

GenerateOrder 成员指示代码生成器按以下属性的 Order 属性确定的特定顺序创建序列化代码: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:

备注

在类型中的一个公共属性或字段上设置 Order 属性后,必须将该属性应用于该类型和所有继承的类型的所有公共属性和字段。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.

适用于

另请参阅