How to Hold the Workflow service.
http://keyvan.io/sqlworkflowpersistenceservice-in-windows-workflow-foundation
WorkflowRuntime workflowRuntime = new WorkflowRuntime();
SqlWorkflowPersistenceService sqlPersistenceService =
new SqlWorkflowPersistenceService(this.connectionString);
workflowRuntime.AddService(sqlPersistenceService);
workflowRuntime.StartRuntime();
WorkflowInstance instance =
workflowRuntime.GetWorkflow(this.id);
// gupta here you have to idle the workflow service. call me
MessageBox.Show(instance.InstanceId.ToString(), "Instance GUID");
instance.Unload();
workflowRuntime.StopRuntime();
http://odetocode.com/articles/457.aspx [ VERY HELPFUL]
(using(AutoResetEvent reset = new AutoResetEvent(false))
{
runtime.WorkflowCompleted += delegate { reset.Set(); };
runtime.WorkflowTerminated += delegate { reset.Set(); };
runtime.StartRuntime();
WorkflowInstance instance;
instance = runtime.CreateWorkflow(typeof(SimpleWorkflow));
instance.Start();
reset.WaitOne();
}
one more resource:
http://www.devproconnections.com/article/net-framework2/introducing-net-4-0-workflow-services-122120