// creates a workflow application, binds parameters, links extensions and run it public WorkflowApplication CreateAndRun(RequestForProposal rfp) { // input parameters for the WF program IDictionary <string, object> inputs = new Dictionary <string, object>(); inputs.Add("Rfp", rfp); // create and run the WF instance Activity wf = new PurchaseProcessWorkflow(); WorkflowApplication instance = new WorkflowApplication(wf, inputs) { PersistableIdle = OnIdleAndPersistable, Completed = OnWorkflowCompleted, Idle = OnIdle }; XmlWorkflowInstanceStore store = new XmlWorkflowInstanceStore(instance.Id); instance.InstanceStore = store; //Create the persistence Participant and add it to the workflow instance XmlPersistenceParticipant xmlPersistenceParticipant = new XmlPersistenceParticipant(instance.Id); instance.Extensions.Add(xmlPersistenceParticipant); // add a tracking participant instance.Extensions.Add(new SaveAllEventsToTestFileTrackingParticipant()); // add instance to the host list of running instances this.instances.Add(instance.Id, instance); // continue executing this instance instance.Run(); return(instance); }
// creates a workflow application, binds parameters, links extensions and run it public WorkflowApplication CreateAndRun(RequestForProposal rfp) { // input parameters for the WF program IDictionary<string, object> inputs = new Dictionary<string, object>(); inputs.Add("Rfp", rfp); // create and run the WF instance Activity wf = new PurchaseProcessWorkflow(); WorkflowApplication instance = new WorkflowApplication(wf, inputs); XmlWorkflowInstanceStore store = new XmlWorkflowInstanceStore(instance.Id); instance.InstanceStore = store; instance.PersistableIdle += OnIdleAndPersistable; instance.Completed += OnWorkflowCompleted; instance.Idle += OnIdle; //Create the persistence Participant and add it to the workflow instance XmlPersistenceParticipant xmlPersistenceParticipant = new XmlPersistenceParticipant(instance.Id); instance.Extensions.Add(xmlPersistenceParticipant); // add a tracking participant instance.Extensions.Add(new SaveAllEventsToTestFileTrackingParticipant()); // add instance to the host list of running instances this.instances.Add(instance.Id, instance); // continue executing this instance instance.Run(); return instance; }