WorkflowInvoker Class (System.Activities)

Switch View :
ScriptFree
.NET Framework Class Library
WorkflowInvoker Class

Provides a means for invoking a workflow as if it were a method call.

Inheritance Hierarchy

System.Object
  System.Activities.WorkflowInvoker

Namespace:  System.Activities
Assembly:  System.Activities (in System.Activities.dll)
Syntax

Visual Basic
Public NotInheritable Class WorkflowInvoker
C#
public sealed class WorkflowInvoker
Visual C++
public ref class WorkflowInvoker sealed
F#
[<Sealed>]
type WorkflowInvoker =  class end

The WorkflowInvoker type exposes the following members.

Constructors

  Name Description
Public method WorkflowInvoker Initializes a new instance of the WorkflowInvoker class.
Top
Properties

  Name Description
Public property Extensions Gets the Collection<T> of extensions that are available to workflows invoked by a WorkflowInvoker instance.
Top
Methods

  Name Description
Public method BeginInvoke(AsyncCallback, Object) Invokes a workflow asynchronously using the specified AsyncCallback and user-provided state.
Public method BeginInvoke(IDictionary<String, Object>, AsyncCallback, Object) Invokes a workflow asynchronously using the specified IDictionary<TKey, TValue> of input parameters, AsyncCallback, and user-provided state.
Public method BeginInvoke(TimeSpan, AsyncCallback, Object) Invokes a workflow asynchronously using the specified time-out interval, AsyncCallback, and user-provided state.
Public method BeginInvoke(IDictionary<String, Object>, TimeSpan, AsyncCallback, Object) Invokes a workflow asynchronously using the specified IDictionary<TKey, TValue> of input parameters, time-out interval, AsyncCallback, and user-provided state.
Public method CancelAsync Attempts to cancel the workflow that was invoked with the specified userState.
Public method EndInvoke Returns the results of a workflow that was invoked using one of the BeginInvoke() overloads.
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method Invoke() Invokes a workflow synchronously using the workflow definition passed to the WorkflowInvoker(Activity) constructor.
Public method Static member Invoke(Activity) Invokes a workflow synchronously using the specified workflow definition.
Public method Invoke(IDictionary<String, Object>) Invokes the activity passed to the WorkflowInvoker(Activity) constructor synchronously with the specified IDictionary<TKey, TValue> of input parameters.
Public method Invoke(TimeSpan) Invokes a workflow synchronously with the specified time-out interval.
Public method Static member Invoke(Activity, IDictionary<String, Object>) Invokes a workflow synchronously using the specified workflow definition and IDictionary<TKey, TValue> of input parameters.
Public method Static member Invoke(Activity, TimeSpan) Invokes a workflow synchronously using the specified workflow definition and time-out interval.
Public method Invoke(IDictionary<String, Object>, TimeSpan) Invokes the activity passed to the WorkflowInvoker(Activity) constructor synchronously with the specified IDictionary<TKey, TValue> of input parameters and the specified time-out interval.
Public method Static member Invoke(Activity, IDictionary<String, Object>, TimeSpan) Invokes a workflow synchronously using the specified workflow definition, IDictionary<TKey, TValue> of input parameters, and time-out interval.
Public method Static member Invoke<TResult>(Activity<TResult>) Invokes a workflow synchronously using the workflow definition passed to the WorkflowInvoker(Activity) constructor.
Public method Static member Invoke<TResult>(Activity<TResult>, IDictionary<String, Object>) Invokes a workflow synchronously using the specified workflow definition and IDictionary<TKey, TValue> of input parameters.
Public method Static member Invoke<TResult>(Activity<TResult>, IDictionary<String, Object>, TimeSpan) Invokes a workflow synchronously using the specified workflow definition, IDictionary<TKey, TValue> of input parameters, and time-out interval.
Public method Static member Invoke<TResult>(Activity<TResult>, IDictionary<String, Object>, IDictionary<String, Object>, TimeSpan) Invokes a workflow synchronously using the specified workflow definition, IDictionary<TKey, TValue> of input parameters, IDictionary<TKey, TValue> of additional output parameters, and time-out interval.
Public method InvokeAsync() Invokes a workflow asynchronously.
Public method InvokeAsync(Object) Invokes a workflow asynchronously using the specified unique identifier.
Public method InvokeAsync(IDictionary<String, Object>) Invokes a workflow asynchronously using the specified IDictionary<TKey, TValue> of input parameters.
Public method InvokeAsync(TimeSpan) Invokes a workflow asynchronously with the specified time-out interval.
Public method InvokeAsync(IDictionary<String, Object>, Object) Invokes a workflow asynchronously using the specified IDictionary<TKey, TValue> of input parameters and a unique identifier.
Public method InvokeAsync(IDictionary<String, Object>, TimeSpan) Invokes a workflow asynchronously with the specified IDictionary<TKey, TValue> of input parameters and the specified time-out interval.
Public method InvokeAsync(TimeSpan, Object) Invokes a workflow asynchronously with the specified time-out interval and a unique identifier.
Public method InvokeAsync(IDictionary<String, Object>, TimeSpan, Object) Invokes a workflow asynchronously with the specified IDictionary<TKey, TValue> of input parameters, the specified time-out interval, and a unique identifier.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Top
Events

  Name Description
Public event InvokeCompleted Occurs when the workflow invoked by one of the InvokeAsync() overloads is completed or canceled.
Top
Remarks

WorkflowInvoker contains both instance and static methods for invoking workflows synchronously, and instance methods for invoking workflows asynchronously.

WorkflowInvoker does not allow instance control such as persisting, unloading, or resuming bookmarks. If instance control is desired, use WorkflowApplication instead.

To execute workflows synchronously with no instance control, call the Invoke() method. To execute a workflow asynchronously with no instance control, use the BeginInvoke(AsyncCallback, Object) and EndInvoke(IAsyncResult) method pairs, or the InvokeAsync(IDictionary<String, Object>) method.

Examples

The following example synchronously invokes a workflow consisting of a single WriteLine activity using WorkflowInvoker.

C#

Activity wf = new WriteLine
{
    Text = "Hello World."
};

WorkflowInvoker.Invoke(wf);


Version Information

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4
Platforms

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also

Reference