Class HumlPolymorphicAttribute

Namespace
Huml.Net.Serialization
Assembly
Huml.Net.dll

Marks a class or interface as the polymorphic base for discriminator-based dispatch. The discriminator key (default _type) is emitted as the first mapping entry during serialisation and consumed during deserialisation to select the concrete type.

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
public sealed class HumlPolymorphicAttribute : Attribute
Inheritance
HumlPolymorphicAttribute
Inherited Members

Constructors

HumlPolymorphicAttribute(string)

Initialises a new instance with the specified discriminator key name.

public HumlPolymorphicAttribute(string typeDiscriminatorPropertyName = "_type")

Parameters

typeDiscriminatorPropertyName string

The HUML key name for the type discriminator. Must be a valid HUML bare key.

Properties

TypeDiscriminatorPropertyName

The HUML key used to identify the derived type. Defaults to _type.

public string TypeDiscriminatorPropertyName { get; }

Property Value

string

UnknownDerivedTypeHandling

Controls behaviour when the discriminator value is not recognised. Defaults to Throw.

public HumlUnknownDerivedTypeHandling UnknownDerivedTypeHandling { get; set; }

Property Value

HumlUnknownDerivedTypeHandling