Table of Contents

Class SystemTextJsonObjectSerializer

Namespace
Quartz.Impl
Assembly
Quartz.dll

Default object serialization strategy that uses JsonSerializer under the hood.

public class SystemTextJsonObjectSerializer : IObjectSerializer
Inheritance
SystemTextJsonObjectSerializer
Implements
Inherited Members

Constructors

SystemTextJsonObjectSerializer()

Creates a serializer that knows the built-in trigger and calendar types only.

public SystemTextJsonObjectSerializer()

SystemTextJsonObjectSerializer(SystemTextJsonSerializerRegistry)

Creates a serializer that resolves trigger and calendar serializers through the given registry, so a scheduler's custom types are known to its own serializer and to no other.

public SystemTextJsonObjectSerializer(SystemTextJsonSerializerRegistry registry)

Parameters

registry SystemTextJsonSerializerRegistry

Properties

Registry

The trigger and calendar serializers this serializer's converters resolve through.

protected SystemTextJsonSerializerRegistry Registry { get; }

Property Value

SystemTextJsonSerializerRegistry

Methods

CreateSerializerOptions()

Builds the options this serializer reads and writes with: Quartz's converters, and the resolver chain that lets them work where reflection-based serialization is switched off.

protected virtual JsonSerializerOptions CreateSerializerOptions()

Returns

JsonSerializerOptions

Remarks

The chain is Quartz's own generated JsonSerializerContext, then the scheduler's registry — the trigger and calendar types registered with it, and whatever the application handed to AddTypeInfoResolver(IJsonTypeInfoResolver) — then reflection, where a publish has left any. A resolver decides only how a type is answered; the payload is still written by the converters, byte for byte as every earlier version of Quartz wrote it.

Deserialize<T>(byte[])

Deserializes object from byte array presentation.

public T? Deserialize<T>(byte[] data) where T : class

Parameters

data byte[]

Data to deserialize object from.

Returns

T

Type Parameters

T

Serialize<T>(T)

Serializes given object as bytes that can be stored to permanent stores.

public byte[] Serialize<T>(T obj) where T : class

Parameters

obj T

Object to serialize.

Returns

byte[]

Type Parameters

T

Remarks

Written as object so that the payload names the runtime type, which is what every stored blob has always said. Asking the options for that type's metadata and handing the result to JsonSerializer is the same call the overload taking JsonSerializerOptions would make internally, minus that overload's blanket RequiresUnreferencedCode — it is what a trimmed application needs and what keeps this class out of the trim-analysis baseline.