CallerContextServiceSpawnTaskTResult Method

Creates an asynchronous task which runs with the current caller context.

Namespace: Dundas.BI.Services
Assembly: Dundas.BI.Core (in Dundas.BI.Core.dll) Version: 2.0.0.0 (26.2.0.1000)
Syntax
public Task<TResult> SpawnTask<TResult>(
	string name,
	Func<TResult> func,
	GroupCancellationToken? cancellationToken
)

Parameters

name  String
A name which will be assigned to the spawned operation (used for diagnostic purposes).
func  FuncTResult
The function to invoke asynchronously.
cancellationToken  GroupCancellationToken
The cancellation token.

Type Parameters

TResult
The type of object returned by the task.

Return Value

TaskTResult
A task object representing the asynchronous operation.

Implements

ICallerContextServiceSpawnTaskTResult(String, FuncTResult, GroupCancellationToken)
Exceptions
ExceptionCondition
ArgumentNullExceptionfunc is .
Remarks
The spawned task will have the same caller context as the code which called this method. Therefore, if the caller context of the calling method is disposed before the body of the spawned task has completed, the task may lose its caller context during execution. If you want to ensure that the caller context remains valid for the entire duration of the spawned task, because the task may outlive the calling method's context, use QueueBackgroundTask(Action, TimeSpan, CancellationToken).
See Also