Wire Serializer

Source
NuGet Package NServiceBus.Wire (2.x) | License
This is a community maintained project. License and support are independent of Particular Software.
Target NServiceBus Version: 6.x

Serializes messages with the Wire binary format.

Usage

endpointConfiguration.UseSerialization<WireSerializer>();
This serializer does not support [messages defined as interfaces](/nservicebus/messaging/messages-as-interfaces.md. If an explicit interface is sent, an exception will be thrown with the following message:

Interface based message are not supported.
Create a class that implements the desired interface

Instead, use a public class with the same contract as the interface. The class can optionally implement any required interfaces.

Custom settings

Customizes the instance of SerializerOptions used for serialization.

var options = new SerializerOptions(
    preserveObjectReferences: true);
var serialization = endpointConfiguration.UseSerialization<WireSerializer>();
serialization.Options(options);

Custom content key

When using additional deserializers or transitioning between different versions of the same serializer it can be helpful to take explicit control over the content type a serializer passes to NServiceBus (to be used for the ContentType header).

var serialization = endpointConfiguration.UseSerialization<WireSerializer>();
serialization.ContentTypeKey("custom-key");

Samples


Last modified