Zhisheng Huang's Blog

file based workflow peristence service

WF comes with SqlWorkflowPersistenceService out of the box. But SQL is not always available, or you may just want to try your workflow program with the persistence. I implemented a file based persistence service as attached. Note it does not implement the UnlockWorkflowInstanceState which is needed only when multiple workflow runtime share the instance persistence store.

To use it, simply add the service to the runtime. 

FileWorkFlowPersisetenceService fServ = new FileWorkFlowPersisetenceService(".");
workflowRuntime.AddService(fServ);

UnloadOnIdle returns true always in the implementation. So you can see that the workflow is persisted after each call when it becomes idled if you hook up the appropriate event:

workflowRuntime.WorkflowPersisted += delegate
{
       Console.WriteLine("Workflow persisted");
};

Published Thursday, November 30, 2006 3:43 PM by zhish

Attachment(s): FileWorkFlowPersisetenceService.cs

Comments

 

smilestone said:

有时候用Sql来持久化工作流不是很爽,这里给出了用文件来持久化工作流的方法

March 13, 2007 5:38 AM
Anonymous comments are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker