Skip to content

Latest commit

 

History

History
 
 

RPGCore.Data.Polymorphic

RPGCore.Data.Polymorphic

Serialization standards and polymorphic type support for serialized objects.

Usage

The descrminator used to determine what type the object is included in the Json output.

Child types with attribute output

Resolving subtypes automatically

Subtypes for a known base type can be determined via reflection at runtime using the ResolveSubTypesAutomatically method.

Usage

When a RemoveProcedure from the previous sample is serialized the following json is produced.

Child types with attribute output

Registering subtypes explicitly

Subtypes for a known base type can be explicitly registered and configured on a per-type basis.

Usage

When a RemoveProcedure from the previous sample is serialized the following json is produced.

Child types with attribute output

RPGCore.Data.Polymorphic.Inline

Attributes can be used to declare what types should serialize to preserve object types.

Base type with attribute and naming convention

When a type that inherits from this IProcedure is serialized, the following json is produced.

Base type with attribute and naming convention serialized output

Explicit type naming

An explicit set of types that are serializable can be declared ahead-of-time.

Base type with explicit attributes

Attributes can also be used on the child types.

Child types with attribute

Using either of the previous demos, when a RemoveProcedure is serialized the following json is produced.

Child types with attribute output