Execution status of a Workflow Instance

We can determine the Execution status of an workflow instance using the workflow definition.. Workflow definition of an workflow instance provice the current execution status. Base class Activity contain one field named – ExecutionStatus which is a member of ActivityExecutionStatus Enum. ActivityExecutionEnum contain following values –

  • Initialized
  • Cancelling
  • Closed
  • Executing
  • Faulting
  • Compensating

Example –

Console.WriteLine( "Workflow Execution status :{0} ", instance.GetWorkflowDefinition().ExecutionStatus.ToString());


Dehydration & Rehydration in WF

If we have a long running workflow tasks or have a  large number of workflow tasks executing , we can unload and store it in a temporary storage using Persistence services ships with Workflow Foundation.

Dehydration : Removing a workflow instance from execution status and storing it away for later recall is called Dehydration. Typically persistence services that comes with WF is used for this purpose, but you can write your own service to perform the same task.

Rehydration: When needed – the workflow instance is brought back from persistence service. The process of bringing it back into an execution status is known as Rehydration.

The main goal is to unload the long running tasks from memory and store then in temporary storage and retrieve it when its needed. And by this way – it’s possible to provide efficient memory utilization.