Class DefaultPayloadConverter
Default implementation of a payload converter which iterates over a collection of IEncodingConverter.
Implements
Namespace: Temporalio.Converters
Assembly: Temporalio.dll
Syntax
public class DefaultPayloadConverter : object, IPayloadConverter
Remarks
See DefaultPayloadConverter() for the default set of encoding converters used. To create a custom converter, a new class should extend this one.
Constructors
DefaultPayloadConverter()
Initializes a new instance of the DefaultPayloadConverter class.
Declaration
public DefaultPayloadConverter()
Remarks
The default payload converter uses the following set of payload converters in order:
Each of those converters are tried in that order when converting to payload, stopping at the first one that can convert. This means nulls, byte arrays, and protobuf messages are all have their own encoding and anything else falls through to the JSON converter. The JSON converter will fail on anything it can't convert.
This also means binary proto converter will never be used when converting to a payload since the JSON proto converter will accept proto objects first. It is present however for converting from payloads which may have its encoding (e.g. from another language that is using binary proto instead of JSON proto).
DefaultPayloadConverter(IEnumerable<IEncodingConverter>)
Initializes a new instance of the DefaultPayloadConverter class with a set of encoding converters.
Declaration
protected DefaultPayloadConverter(IEnumerable<IEncodingConverter> encodingConverters)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IEncodingConverter> | encodingConverters | Encoding converters to use. Duplicate encodings not allowed. |
Remarks
This is protected because payload converters are referenced as class types, not instances, so only subclasses would call this.
See Also
DefaultPayloadConverter(JsonSerializerOptions)
Initializes a new instance of the DefaultPayloadConverter class.
Declaration
protected DefaultPayloadConverter(JsonSerializerOptions jsonSerializerOptions)
Parameters
Type | Name | Description |
---|---|---|
JsonSerializerOptions | jsonSerializerOptions | Custom serializer options. |
Remarks
This is protected because payload converters are referenced as class types, not instances, so only subclasses would call this.
See Also
DefaultPayloadConverter(IEncodingConverter[])
Initializes a new instance of the DefaultPayloadConverter class.
Declaration
protected DefaultPayloadConverter(params IEncodingConverter[] encodingConverters)
Parameters
Type | Name | Description |
---|---|---|
IEncodingConverter[] | encodingConverters | Encoding converters. |
See Also
Properties
EncodingConverters
Gets the encoding converters tried, in order, when converting to payload.
Declaration
public IReadOnlyCollection<IEncodingConverter> EncodingConverters { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<IEncodingConverter> |