WorkflowInvoker.Invoke<TResult> Method (Activity<TResult>, IDictionary<String, Object>, IDictionary<String, Object>%, TimeSpan)
Assembly: System.Activities (in System.Activities.dll)
public static TResult Invoke<TResult>( Activity<TResult> workflow, IDictionary<string, Object> inputs, out IDictionary<string, Object> additionalOutputs, TimeSpan timeout )
The type of the workflow.
- Type: System.Activities.Activity<>
The workflow definition of the workflow to invoke.
- Type: System.Collections.Generic.IDictionary<String, Object>
The dictionary of input parameters to the workflow, keyed by argument name.
- Type: System.Collections.Generic.IDictionary<String, Object>%
The dictionary of additional output parameters of the workflow, keyed by argument name.
A value of type TResult with the result of the execution of the activity.
This method blocks until the workflow has completed, including idle time. All workflow execution is guaranteed to execute on the invoking thread. If the workflow does not complete within the specified time-out interval the workflow is aborted and a TimeoutException is thrown.
The TimeoutException is only thrown if the time-out interval elapses and the workflow becomes idle during execution. A workflow that takes longer than the specified time-out interval to complete, completes successfully if the workflow does not become idle.
The following example invokes a workflow consisting of a single Add activity that has two input arguments and since it derives from CodeActivity<int> it has one well-defined Result output argument. When the workflow is invoked, the arguments dictionary is passed which contains the values for each input argument, keyed by argument name. When the call to Invoke returns, the value of the Result output argument is returned. This code example is based off of the Using the WorkflowInvoker Class sample.
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.