Table of Contents

Class WorkflowHost

Namespace
Acuit.Pinpoint.Workflows
Assembly
Acuit.Pinpoint.Workflows.dll

Provides a host for a single instance of a workflow. Hosts provide access to the workflow data context and the ability to raise workflow events.

public sealed class WorkflowHost : IDisposable
Inheritance
WorkflowHost
Implements
Inherited Members

Constructors

WorkflowHost(IActivity, IParameterValueProvider, IServiceProvider)

Creates a workflow host for the specified activity and starts the workflow.

public WorkflowHost(IActivity activity, IParameterValueProvider parameterValueProvider, IServiceProvider serviceProvider)

Parameters

activity IActivity

The root workflow activity.

parameterValueProvider IParameterValueProvider

The parameter value provider for the workflow to use.

serviceProvider IServiceProvider

The service provider for the workflow to use.

Remarks

If the workflow execution throws an exception synchronously, the workflow host will still be created, and the exception will be exposed via a faulted Task.

Exceptions

ArgumentNullException

activity is null.

ArgumentNullException

parameterValueProvider is null.

ArgumentNullException

serviceProvider is null.

WorkflowHost(IActivity, IServiceProvider)

Creates a workflow host for the specified activity and starts the workflow.

public WorkflowHost(IActivity activity, IServiceProvider serviceProvider)

Parameters

activity IActivity

The root workflow activity.

serviceProvider IServiceProvider

The service provider for the workflow to use.

Remarks

If the workflow execution throws an exception synchronously, the workflow host will still be created, and the exception will be exposed via a faulted Task.

Exceptions

ArgumentNullException

activity is null.

ArgumentNullException

serviceProvider is null.

Properties

DataContext

Gets the workflow data context, which provides access to the workflow-level variables (i.e., variables defined by the top-level activity).

public WorkflowDataContext DataContext { get; }

Property Value

WorkflowDataContext

Remarks

This supports full binding functionality from WPF views.

Result

Gets the result of the workflow if the root activity produces a result, or null if it does not or if the workflow has not completed execution.

public object Result { get; }

Property Value

object

Task

Gets the Task representing the workflow execution.

public Task Task { get; }

Property Value

Task

Remarks

If the workflow execution fails, the task will result in a faulted state with one of the following exceptions:

Methods

Dispose()

Closes and releases all resources used by the WorkflowHost. If the workflow is running, this will request cancellation first, closing and releasing all resources once the workflow completes.

public void Dispose()

RaiseEvent<TEvent>(TEvent)

Raises an event on the workflow event bus.

public void RaiseEvent<TEvent>(TEvent e)

Parameters

e TEvent

The event.

Type Parameters

TEvent

The event type.

Remarks

See the remarks for RaiseEvent<TEvent>(TEvent) for more information.

Exceptions

ObjectDisposedException

The object has been disposed.

RequestCancel()

Requests canceling the workflow execution.

public void RequestCancel()

Exceptions

ObjectDisposedException

The object has been disposed.