NEventStore/NEventStore.Persistence.RavenDB — pull request #6 by volak (2014-12-30 22:51:46+00:00)
Title: Adding support for user customizations of ravendb's serializer

There is a property off of _store.Conventions that allows users to customize the way RavenDb serializes. This is of particular use to me because I use NServicebus which handles events as interfaces which Json.NET can't deserialize properly (always a dynamic type).
I have to hook into Json.NET's contract resolver to message map the event back to its interface definition so aggregate Handle methods can process it correctly.

This patch adds a SerializerCustomizations property to RavenPersistenceOptions which is an `Action` - exactly the same thing `_store.Conventions.CustomizeJsonSerializer` accepts.

Which allows me to inject custom binders and contract resolvers into ravendb like so:

```C#
public static RavenPersistenceWireup UsingAggregatesRavenPersistence(
this Wireup wireup,
string connectionName)
{
var options = new RavenPersistenceOptions(serializerCustomizations: s =>
{
s.Binder = new EventSerializationBinder();
s.ContractResolver = new EventContractResolver();
});

return wireup.UsingRavenPersistence(connectionName, options);
}
```

This behavior is much cleaner then what the elliotritchie/NES project does, which is here: https://github.com/elliotritchie/NES/blob/v5/src/NES.NEventStore.Raven/CustomizedRavenSerializerWireup.cs

he actually has to use reflection to pull the IDocumentStore from your object. Figured this was a better solution