public TResponse ContinueWorkflow <TRequest, TResponse>(WorkflowDefinition definition, TRequest request, string OperationName) { TResponse response = default(TResponse); WorkflowInstanceManager workflowManager = new WorkflowInstanceManager(definition.Workflow); //workflowManager.instanceStore = InstanceStore; workflowManager.instanceStore = WorkflowActivator.GetScope().ServiceProvider.GetService <System.Activities.Runtime.DurableInstancing.InstanceStore>(); if (workflowManager.instanceStore is IStoreCorrelation) { (workflowManager.instanceStore as IStoreCorrelation).Correlation = new WorkflowCorrelation() { //CorrelationId = definition.InstanceCorrelation, CorrelationId = definition.Correlation.CorrelationId, //WorkflowId = wfApp.Id, }; } try { response = workflowManager.ContinueWorkflow <TRequest, TResponse>(request, OperationName); definition.Correlation.WorkflowId = workflowManager.WorkflowId; } catch (Exception exc) { throw exc; } return(response); }
public WorkflowInstanceManager StartWorkflow(Activity workflow) { WorkflowInstanceManager workflowManager = new WorkflowInstanceManager(workflow); workflowManager.instanceStore = InstanceStore; return(workflowManager); }