Class JobInputBuilderExtensions
- Namespace
- Quartz
- Assembly
- Quartz.dll
Puts an IJob<TInput>'s input on the job or the trigger being built.
public static class JobInputBuilderExtensions
- Inheritance
-
JobInputBuilderExtensions
- Inherited Members
Remarks
Extensions rather than members, because a method cannot constrain its own type's type parameter:
JobBuilder<TJob> is declared for any TJob : IJob, and a member saying
where TJob : IJob<TInput> is CS0699. Written here, the constraint is the method's own
and the compiler can check it — so UsingInput is offered on a builder for a typed job and
refused on a builder for a job that takes no input.
The input type is inferred from the argument's static type. A payload held as a base type —
or as object — is stored and read back as that type unless the type argument is given
explicitly: builder.UsingInput<SendEmailJob, SendEmail>(payload).
The value goes into the map as it is; the scheduler serializes it as the job or trigger is stored, which is the only point at which a serializer exists. So a builder needs none, and a job data map built here can still be inspected before it is scheduled.
Methods
UsingInput<TJob, TInput>(IJobConfigurator<TJob>, TInput)
Sets the input the job carries.
public static IJobConfigurator<TJob> UsingInput<TJob, TInput>(this IJobConfigurator<TJob> configurator, TInput input) where TJob : IJob<TInput>
Parameters
configuratorIJobConfigurator<TJob>The job being configured.
inputTInputThe payload the job runs with.
Returns
- IJobConfigurator<TJob>
Type Parameters
TJobTInput
UsingInput<TJob, TInput>(ITriggerConfigurator<TJob>, TInput)
Sets the input this trigger's firings carry, overriding any input on the job.
public static ITriggerConfigurator<TJob> UsingInput<TJob, TInput>(this ITriggerConfigurator<TJob> configurator, TInput input) where TJob : IJob<TInput>
Parameters
configuratorITriggerConfigurator<TJob>The trigger being configured.
inputTInputThe payload the job runs with when this trigger fires it.
Returns
- ITriggerConfigurator<TJob>
Type Parameters
TJobTInput
UsingInput<TJob, TInput>(JobBuilder<TJob>, TInput)
Sets the input the job carries.
public static JobBuilder<TJob> UsingInput<TJob, TInput>(this JobBuilder<TJob> builder, TInput input) where TJob : IJob<TInput>
Parameters
builderJobBuilder<TJob>The job being built.
inputTInputThe payload the job runs with.
Returns
- JobBuilder<TJob>
Type Parameters
TJobTInput
Remarks
An input on the job is the default for every one of its triggers, and any trigger can override it. Note that a PersistJobDataAfterExecutionAttribute job re-stores its own map after every firing, so an input meant to differ per firing belongs on the trigger.
UsingInput<TJob, TInput>(TriggerBuilder<TJob>, TInput)
Sets the input this trigger's firings carry, overriding any input on the job.
public static TriggerBuilder<TJob> UsingInput<TJob, TInput>(this TriggerBuilder<TJob> builder, TInput input) where TJob : IJob<TInput>
Parameters
builderTriggerBuilder<TJob>The trigger being built.
inputTInputThe payload the job runs with when this trigger fires it.
Returns
- TriggerBuilder<TJob>
Type Parameters
TJobTInput