You can consider a correlation token as a unique identifier that enables mapping between the objects in a workflow and the environment hosting the Windows Workflow Foundation (WF) workflow runtime.
Windows Workflow Foundation must provide some way for a workflow to communicate with other software. The Windows Workflow Foundation runtime acts as an intermediary for all communication with all workflows.
When an incoming request arrives, the runtime receives it and then determines which workflow instance this request is destined for.
The runtime then delivers the request to the target instance. In effect, the Windows Workflow Foundation acts as a proxy for all communication with software outside of the workflow.
You will have a separate correlation token for the each of the following:
- The workflow itself
- Each task you need to reference in the workflow
Do not assign your workflow task the same correlation token as the workflow itself.
Declare the correlation token for the workflow in the OnWorkflowActivated activity. Then, for each activity that affects the entire workflow, bind that activity’s correlation token to the correlation token of the OnWorkflowActivated activity.