Table of Contents

Class EventSerializer

Namespace
Cratis.Chronicle.Events
Assembly
Cratis.Chronicle.dll

Represents an implementation of IEventSerializer.

[Singleton]
public class EventSerializer : IEventSerializer
Inheritance
EventSerializer
Implements
Inherited Members

Constructors

EventSerializer(IClientArtifactsProvider, IServiceProvider, IEventTypes, JsonSerializerOptions)

Initializes a new instance of the EventSerializer class.

public EventSerializer(IClientArtifactsProvider clientArtifacts, IServiceProvider serviceProvider, IEventTypes eventTypes, JsonSerializerOptions serializerOptions)

Parameters

clientArtifacts IClientArtifactsProvider

Optional IClientArtifactsProvider for the client artifacts.

serviceProvider IServiceProvider

IServiceProvider for resolving instances.

eventTypes IEventTypes

IEventTypes for resolving event types.

serializerOptions JsonSerializerOptions

The common .

Methods

Deserialize(AppendedEvent)

Deserialize an AppendedEvent to its actual type.

public Task<object> Deserialize(AppendedEvent @event)

Parameters

event AppendedEvent

AppendedEvent to deserialize.

Returns

Task<object>

The deserialized event in the target CLR type.

Deserialize(Type, ExpandoObject)

Deserialize a JSON representation of an event to a specific type.

public Task<object> Deserialize(Type type, ExpandoObject expandoObject)

Parameters

type Type

Type to deserialize to.

expandoObject ExpandoObject

Object to deserialize.

Returns

Task<object>

Deserialized instance.

Deserialize(Type, JsonObject)

Deserialize a JSON representation of an event to a specific type.

public Task<object> Deserialize(Type type, JsonObject json)

Parameters

type Type

Type to deserialize to.

json JsonObject

JSON to deserialize.

Returns

Task<object>

Deserialized instance.

Serialize(object)

Serialize an event to JSON.

public Task<JsonObject> Serialize(object @event)

Parameters

event object

The event instance to serialize.

Returns

Task<JsonObject>

Serialized JSON.