views:

175

answers:

1

I've been doing lots of work recently on the new Workflow 4.0. One of the things that would make it easier to whip together test apps would be an in memory InstanceStore. One that holds offloaded workflows in memory for a short while.

The documentation on how to create a store is pretty anemic, and the interface on it is pretty complex and obscure. Instead of investing a day figuring it out, I'm wondering if anybody knows of either a good explanation of how to implement an InstanceStore, or just some code that does what I'm looking for.

A: 

It looks like the 2 things you really need to implement are these virtual protected members:

object OnCreateInstanceHandle(InstanceHandle);

and

void OnFreeInstanceHandle(InstanceHandle, object);

Edit: WRONG see below

Tim Lovell-Smith
I could tell you about that much. I'm looking for details on how to accomplish this, as I don't recognize a pattern here and the documentation is a bit lacking in details on how one of these things work.
Will
Update, I investigated this more and it seems like I was totally wrong about this. The *real* thing you need to do seems to be writing a command handler, probably overriding ExecuteCommand(), which handles the different subclasses of System.Runtime.DurableInstancing.InstancePersistenceCommand, such as LoadWorkflowByInstanceKeyCommand
Tim Lovell-Smith
I'm accepting because I believe your last comment is correct (the whole "ExecuteCommand" pattern is a bit bizarre to me but it appears to be how it works) and I don't think there are any ready-made solutions out there. Thanks.
Will
I just found out recently that there is also a XmlPersistantStore sample in the official WF samples. Path:WF\Application\PurchaseProcess\CodedWorkflow\CS\WfDefinition\XmlWorkflowInstanceStore.cs
Tim Lovell-Smith