Click or drag to resize
JobFromExpression Method (ExpressionAction)
Gets a new instance of the Job class based on the given expression tree of a method call.

Namespace: Hangfire.Common
Assembly: Hangfire.Core (in Hangfire.Core.dll) Version:
public static Job FromExpression(
	[InstantHandleAttribute] Expression<Action> methodCall


Type: System.Linq.ExpressionsExpressionAction
Expression tree of a method call.

Return Value

Type: Job
ArgumentNullExceptionmethodCall is null.
ArgumentExceptionmethodCall expression body is not of type MethodCallExpression.
NotSupportedExceptionmethodCall expression contains a method that is not supported.
InvalidOperationExceptionmethodCall instance object of a given expression points to .

The Type property of a returning job will point to the type of a given instance object when it is specified, or to the declaring type otherwise. All the arguments are evaluated using the expression compiler that uses caching where possible to decrease the performance penalty.

Note Note
Instance object (e.g. () => instance.Method()) is only used to obtain the type for a job. It is not serialized and not passed across the process boundaries.
See Also