This project is read-only.

Persistence

Jun 25, 2008 at 10:45 PM
I'd be interested in how you would approach state persistence. What would be an appropriate time or trigger to capture the current state: would you just inject the data repository interface in to each state then listen for an "on state changed" event?

I'm kind of (very!) new to this approach but see how it could be simple yet effective for a series of WCF services I'm writing. Any feedback would be greatly appreciated.

Dylan
Coordinator
Jun 27, 2008 at 12:30 AM
Dylan, I checked in a new version that automates the process of persistence to some extent. Please see the Persistence tests for how to use, but generally speaking I added an overload to StateMachineContext that accepts the interface IStateMachineContextPersistenceService. If you pass in such a service, then the Save(context) method will be called at an appropriate time (after all other work has been done in the Transition State method). If you use the WorkflowService to create and run your state machines (again, see the PersistenceTestFixture for a sample) and you construct your WorkflowService with an IDomainContextRepository, then that should be enough. Let me know if any of that made any sense :)

dvhthomas wrote:
I'd be interested in how you would approach state persistence. What would be an appropriate time or trigger to capture the current state: would you just inject the data repository interface in to each state then listen for an "on state changed" event?

I'm kind of (very!) new to this approach but see how it could be simple yet effective for a series of WCF services I'm writing. Any feedback would be greatly appreciated.

Dylan