Protobuf-net serial converter for NEventStore 3+

Can someone point me to the protobuf-net serializer for NEventStore 3.0?

I have problems, I think, mainly due to serialization in Event Store 3, wrapping the body of the event and the headers in EventMessage.

I'm not sure how to set up a custom serializer correctly.

+4
source share
1 answer

This is a completely unverified conjecture based on a very brief look at github, but it looks like you want to use the posting API to specify a custom serializer, for example:

var store = Wireup.Init() .UsingSqlPersistence("Name Of EventStore ConnectionString In Config File") .InitializeStorageEngine() .UsingCustomSerialization(mySerializer) ... etc 

where mySerializer is an instance of a type that implements the ISerialize interface. Seems like this should work:

 class ProtobufSerializer : EventStore.Serialization.ISerialize { public void Serialize<T>(Stream output, T graph) { ProtoBuf.Serializer.Serialize<T>(output, graph); } public T Deserialize<T>(Stream input) { return ProtoBuf.Serializer.Deserialize<T>(input); } } 

(so obviously mySerializer here will be new ProtobufSerializer() )

+3
source

All Articles