Click or drag to resize
BackgroundJobClientCreate Method
Creates a new background job in a specified state.

Namespace: Hangfire
Assembly: Hangfire.Core (in Hangfire.Core.dll) Version: 1.5.0.0
Syntax
public string Create(
	Job job,
	IState state
)

Parameters

job
Type: Hangfire.CommonJob
Job that should be processed in background.
state
Type: Hangfire.StatesIState
Initial state for a background job.

Return Value

Type: String
Unique identifier of a created background job -or-, if it was not created.

Implements

IBackgroundJobClientCreate(Job, IState)
Exceptions
ExceptionCondition
ArgumentNullExceptionjob is null.
BackgroundJobClientExceptionCreation failed due to an exception.
Remarks

The interface allows implementations to return value for this method when background job creation has been canceled by an implementation under the normal circumstances (not due to an exception). For example, the CreatingContext class contains the Canceled property that may be used by a client filter to cancel a background job creation.

The interface allows implementations to create a background job in a state other than specified. The given state instance also may be modified. For example, ElectStateContext class contains public setter for the CandidateState property allowing to choose completely different state by state election filters.

See Also