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, IClientArtifactsActivator, IEventTypes, JsonSerializerOptions)

Initializes a new instance of the EventSerializer class.

public EventSerializer(IClientArtifactsProvider clientArtifacts, IClientArtifactsActivator artifactActivator, IEventTypes eventTypes, JsonSerializerOptions serializerOptions)

Parameters

clientArtifacts IClientArtifactsProvider

Optional IClientArtifactsProvider for the client artifacts.

artifactActivator IClientArtifactsActivator

IServiceProvider for resolving instances.

eventTypes IEventTypes

IEventTypes for resolving event types.

serializerOptions JsonSerializerOptions

The common .

Methods

Deserialize(AppendedEvent)

Get the deserialized content from an AppendedEvent.

public Task<object> Deserialize(AppendedEvent @event)

Parameters

event AppendedEvent

AppendedEvent to get content from.

Returns

Task<object>

The deserialized event content.

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.