Class SystemTextJsonJobInputSerializer
The default IJobInputSerializer: a job's input as JSON, written by JsonSerializer.
public sealed class SystemTextJsonJobInputSerializer : IJobInputSerializer
- Inheritance
-
SystemTextJsonJobInputSerializer
- Implements
- Inherited Members
Remarks
Built exactly as SystemTextJsonObjectSerializer is, so the two agree about what a
scheduler's JSON means, and reading and writing go through the GetTypeInfo overloads that
carry neither RequiresUnreferencedCode nor RequiresDynamicCode — which is what keeps
typed input free of trim warnings and working in a trimmed or natively compiled application.
An application published with reflection-based serialization switched off declares its own payload types through AddJsonTypeInfoResolver(IQuartzBuilder, IJsonTypeInfoResolver), the same call that declares its job data value types to the store's serializer; there is no second registration to learn. A payload type nothing describes is refused with a NotSupportedException that names it and that call, on the way in and on the way out.
Constructors
SystemTextJsonJobInputSerializer()
Creates a serializer that knows the built-in types only.
public SystemTextJsonJobInputSerializer()
SystemTextJsonJobInputSerializer(SystemTextJsonSerializerRegistry)
Creates a serializer that resolves payload metadata through the given registry, so a scheduler's own declared types are known to its own serializer and to no other.
public SystemTextJsonJobInputSerializer(SystemTextJsonSerializerRegistry registry)
Parameters
registrySystemTextJsonSerializerRegistry
Methods
Deserialize<TInput>(string)
Reads back what Serialize(object) wrote.
public TInput? Deserialize<TInput>(string payload)
Parameters
payloadstring
Returns
- TInput
Type Parameters
TInput
Exceptions
- NotSupportedException
Nothing in the resolver chain describes
TInput; see Serialize(object).
Serialize(object)
Writes the input as JSON.
public string Serialize(object input)
Parameters
inputobject
Returns
Remarks
Written as object, so the payload describes the runtime type rather than whatever static type the caller happened to hold — the same choice Serialize<T>(T) makes, for the same reason.
Exceptions
- NotSupportedException
Nothing in the resolver chain describes the input's type, which only a publish without reflection meets. The message names the type and the registration that answers for it.