Definition
Assembly: CloudNimble.XmlEssentials.dll Namespace: CloudNimble.Text.Xml.Serialization Inheritance: System.EnumSyntax
Summary
Specifies the generation mode for the XmlEssentials source generator.Usage
Set the mode with theGenerationMode property of [XmlSourceGenerationOptions] on a context. It applies to every type of the context. To give one listed type another mode, set GenerationMode on its [XmlSerializable<T>] attribute.
Combining
Metadata and Serialization gives the same result as Default.
The metadata describes the constructor and the members of a type: XmlObjectInfoValues<T>, XmlPropertyInfoValues<TValue>, and XmlParameterInfoValues. The serializer reads and writes from it with the engine the reflection resolver uses, so every option, converter, and attribute has the same effect. The write fast path is a method that writes the type directly. It’s used when the options agree with what [XmlSourceGenerationOptions] declares. Every mode is safe for trimming and Native AOT.
The following example writes and reads the same order with a context generated in each mode:
JsonSourceGenerationMode in System.Text.Json. For a comparison of the modes, see Source-generation modes.
View the complete sample on GitHub
Remarks
Type metadata describes the constructor and the members of a type. The serializer reads and writes the type from it with the rules it applies to a type it maps through reflection, and with no reflection over the members. Serialization logic is a write fast path: a method that writes the type directly, which is used when the options agree with the XmlSourceGenerationOptionsAttribute of the context. Every mode is safe for trimming and Native AOT. This enumeration is analogous toJsonSourceGenerationMode in System.Text.Json.
Values
Related APIs
- CloudNimble.Text.Xml.Serialization.XmlSourceGenerationOptionsAttribute
- CloudNimble.Text.Xml.Serialization.XmlSerializableAttribute
- CloudNimble.Text.Xml.Serialization.XmlSerializerContext
- CloudNimble.Text.Xml.Serialization.DefaultXmlTypeInfoResolver