Table of Contents

Class NewtonsoftJsonObjectSerializer

Namespace
Quartz.Impl
Assembly
Quartz.Serialization.Newtonsoft.dll

Object serialization strategy that uses Newtonsoft.Json.JsonSerializer under the hood.

public class NewtonsoftJsonObjectSerializer : IObjectSerializer
Inheritance
NewtonsoftJsonObjectSerializer
Implements
Inherited Members

Constructors

NewtonsoftJsonObjectSerializer()

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

public NewtonsoftJsonObjectSerializer()

NewtonsoftJsonObjectSerializer(NewtonsoftJsonSerializerRegistry)

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 NewtonsoftJsonObjectSerializer(NewtonsoftJsonSerializerRegistry registry)

Parameters

registry NewtonsoftJsonSerializerRegistry

Properties

RegisterTriggerConverters

Whether trigger converters are registered with the underlying serializer.

public bool RegisterTriggerConverters { get; set; }

Property Value

bool

Remarks

The serializer is built on first use, so setting this afterwards would otherwise have no effect; assigning it discards the built serializer so the next use picks the change up.

Registry

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

protected NewtonsoftJsonSerializerRegistry Registry { get; }

Property Value

NewtonsoftJsonSerializerRegistry

Methods

CreateSerializerSettings()

Builds the settings every serialization goes through — the converters for Quartz's own types, and the type handling a stored blob is read back with.

protected virtual JsonSerializerSettings CreateSerializerSettings()

Returns

JsonSerializerSettings

Remarks

Override to add a converter of your own, calling base and adding to what it returns rather than replacing it: a setting dropped here changes the shape of every blob this scheduler writes. The result is cached until RegisterTriggerConverters changes.

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