Table of Contents

Class StateJsonConverter<TRecord, TState>

Namespace
Chronicler
Assembly
Chronicler.dll

Serializes and deserializes an object through its canonical state value.

public sealed class StateJsonConverter<TRecord, TState> : JsonConverter<TRecord> where TRecord : class, IStateBacked<TState>

Type Parameters

TRecord

The state-backed record type.

TState

The serializable state type.

Inheritance
JsonConverter<TRecord>
StateJsonConverter<TRecord, TState>
Inherited Members

Constructors

StateJsonConverter(Func<TState, TRecord>)

Creates a converter that restores records from serialized state using the supplied factory.

public StateJsonConverter(Func<TState, TRecord> factory)

Parameters

factory Func<TState, TRecord>

Methods

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

public override TRecord Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Parameters

reader Utf8JsonReader
typeToConvert Type
options JsonSerializerOptions

Returns

TRecord

Write(Utf8JsonWriter, TRecord, JsonSerializerOptions)

public override void Write(Utf8JsonWriter writer, TRecord value, JsonSerializerOptions options)

Parameters

writer Utf8JsonWriter
value TRecord
options JsonSerializerOptions