Table of Contents

Class JsonMessageSerializerBuilder

Namespace
Silverback.Messaging.Configuration
Assembly
Silverback.Integration.dll
public sealed class JsonMessageSerializerBuilder
Inheritance
JsonMessageSerializerBuilder
Inherited Members

Constructors

JsonMessageSerializerBuilder()

public JsonMessageSerializerBuilder()

Methods

Build()

Builds the IMessageSerializer instance.

public IMessageSerializer Build()

Returns

IMessageSerializer

The IMessageSerializer.

Configure(Action<JsonSerializerOptions>)

Configures the JsonSerializerOptions. The action is applied to a copy of the options set by the previous calls to Configure(Action<JsonSerializerOptions>) or UseJsonSerializerContext(JsonSerializerContext), if any.

public JsonMessageSerializerBuilder Configure(Action<JsonSerializerOptions> configureAction)

Parameters

configureAction Action<JsonSerializerOptions>

An Action<T> that takes the JsonSerializerOptions and configures it.

Returns

JsonMessageSerializerBuilder

The JsonMessageSerializerBuilder so that additional calls can be chained.

DisableTypeHeader()

Specifies that the message type header (see MessageType) must not be set.

public JsonMessageSerializerBuilder DisableTypeHeader()

Returns

JsonMessageSerializerBuilder

The JsonMessageSerializerBuilder so that additional calls can be chained.

SetTypeHeader()

Specifies that the message type header (see MessageType) must be set. This is necessary when sending multiple message type through the same endpoint, to allow Silverback to automatically figure out the correct type to deserialize into.

public JsonMessageSerializerBuilder SetTypeHeader()

Returns

JsonMessageSerializerBuilder

The JsonMessageSerializerBuilder so that additional calls can be chained.

UseJsonSerializerContext(JsonSerializerContext)

Specifies the source-generated JsonSerializerContext to be used. The serializer will use the context's own Options, replacing the options set by the previous calls to Configure(Action<JsonSerializerOptions>). Call Configure(Action<JsonSerializerOptions>) afterwards to further customize a copy of these options, for example to add more contexts to the TypeInfoResolverChain. The additional contexts will use these same options.

public JsonMessageSerializerBuilder UseJsonSerializerContext(JsonSerializerContext context)

Parameters

context JsonSerializerContext

The JsonSerializerContext. Pass the generated Default instance to use the options declared via the JsonSourceGenerationOptionsAttribute.

Returns

JsonMessageSerializerBuilder

The JsonMessageSerializerBuilder so that additional calls can be chained.