Save history of state transitions for WF state machine

332 views Asked by At

I'm investigating using .NET 4.5 Workflow Foundation to implement state machines for certain objects. I wondering how I can save the history of transitions between states. I would be using persistence, but my understanding is that this just tracks the current state, not the history of transitions and it is removed when the terminal state is reached.

Specifically I'm looking for something like the following:

Sequence  Date         Original State   Action      New State    Actor
--------  -----------  ---------------  ----------  -----------  ---------
1         12/25/2013   <none>           <none>      Draft        bsmith
2         12/27/2013   Draft            Submit      Pending      cjones
3         1/2/2014     Pending          Approve     Published    dkelly

The exact format is to be determined, but as is shown, this shows how the object moved from one state to another, by whom and when.

How can this be done with WF?

1

There are 1 answers

0
Arkaine55 On

I suggest you read on MSDN about Workflow Tracking and Tracing in particular you will want to read about Tracking Participants and custom Tracking Participants. The default participant is the windows event log I believe.

Here is the MSDN sample for a custom SQL tracking participant: SQL Tracking Sample