Skip to content

Serialization

RagtimeWilly edited this page Mar 12, 2017 · 2 revisions

Configuring serializers

Serializers are configured via an ISerializerFactory which determines which serializer to use based on the content type provided.

There is a default implementation provided in the core library.

If using the WhiteRabbit.Autofac package the above implementation will be registered by default unless configured off by setting the RegisterDefaultSerializerFactory property to false when registering the WhiteRabbitIoCModule.

Available serializer packages

There are currently two serializers available for use with the White Rabbit library

JSON

PM> Install-Package WhiteRabbit.Json

Content Type = "application/json"

Protobuf

PM> Install-Package WhiteRabbit.Protobuf

Content Type = "application/protobuf"

Autofac

As stated above the default SerializerFactory will be registered by default unless configured off by setting the RegisterDefaultSerializerFactory property to false when registering the WhiteRabbitIoCModule.

There is also helper method provided to register all available ISerializer implementations in a given assembly:

builder
    .RegisterSerializersFrom(new[] { "WhiteRabbit.Json", "WhiteRabbit.Protobuf" });

Clone this wiki locally