-
Notifications
You must be signed in to change notification settings - Fork 2
The Event Serializer
In order to translate between your applicaiton event (implementing IEvent<TStreamId>
) and your persisted event (implementing IPersistedEvent<TId, TStreamId>
) there is an event serializer. The default implementation translates from (Type, object)
to (string, byte[])
and back.
The DefaultEventSerializer<TStreamId, TEvent, TPersistedEvent>
serializes the payload to JSON using Newtonsoft.Json, and then that string to a byte array using UTF8. To ensure it can deserialize again, it stores the payload type as a string using the event registry.
If you're not using the default configuration of persistent storage (e.g. not storing your event payload in a binary
column in SQL Server) you'll want to override this, but for most usages, the default implementation will probably do just fine.