public override ExecutionPipelineDirective InitForExecution(WorkflowExecutorResult executorResult, WorkflowDefinition defintion, WorkflowInstance workflow, ExecutionPointer executionPointer) { if (!executionPointer.EventPublished) { if (EventKey != null) { executionPointer.EventKey = Convert.ToString(EventKey.Compile().DynamicInvoke(workflow.Data)); } DateTime effectiveDate = DateTime.MinValue; if (EffectiveDate != null) { effectiveDate = Convert.ToDateTime(EffectiveDate.Compile().DynamicInvoke(workflow.Data)); } effectiveDate = effectiveDate.ToUniversalTime(); executionPointer.EventName = EventName; executionPointer.Active = false; executorResult.Subscriptions.Add(new EventSubscription() { WorkflowId = workflow.Id, StepId = executionPointer.StepId, EventName = executionPointer.EventName, EventKey = executionPointer.EventKey, SubscribeAsOf = effectiveDate }); return(ExecutionPipelineDirective.Defer); } return(ExecutionPipelineDirective.Next); }
public override ExecutionPipelineDirective InitForExecution(IWorkflowHost host, IPersistenceProvider persistenceStore, WorkflowDefinition defintion, WorkflowInstance workflow, ExecutionPointer executionPointer) { if (!executionPointer.EventPublished) { if (EventKey != null) { executionPointer.EventKey = Convert.ToString(EventKey.Compile().DynamicInvoke(workflow.Data)); } executionPointer.EventName = EventName; executionPointer.Active = false; persistenceStore.PersistWorkflow(workflow).Wait(); host.SubscribeEvent(workflow.Id, executionPointer.StepId, executionPointer.EventName, executionPointer.EventKey).Wait(); return(ExecutionPipelineDirective.Defer); } return(ExecutionPipelineDirective.Next); }