CrystalConverterAttribute

Namespace: SnowBank.Data · class

Implements: Attribute

Marks a partial class as a container of source-generated serializers, for one or more output formats

Remarks

This marker is format-neutral: it says that the class hosts generated code, and nothing about the output(s) it produces. Each format is requested by its own output attribute ([CrystalJsonOutput], [CrystalXmlOutput]), and a container that names none of them is rejected (CRYS0001): a container that produces nothing is never what the author meant.

The types to serialize are registered with one CrystalSerializableAttribute per "root" type; nested and referenced types are discovered automatically.

Sample: [CrystalConverter] [CrystalJsonOutput(CrystalJsonSerializerDefaults.Web)] [CrystalXmlOutput] [CrystalSerializable(typeof(User))] [CrystalSerializable(typeof(Product))] public static partial class ApplicationSerializers { // generated code will be inserted here }

The mono-format aliases [CrystalJsonConverter] and [CrystalXmlConverter] bundle this marker with a single output format, for the common case of a container that only ever produces one output.

Do not subclass: the source generator matches exact attribute metadata names, a derived attribute is invisible to it.

Constructors

CrystalConverterAttribute

CrystalConverterAttribute()

Uses this class as a container for source-generated serializers