Example #1
0
 public Workflow(string name, IWorkflowPersister <TContext> persister, IActivityFactory activityFactory = null, IActivityExecutor activityExecutor = null)
 {
     m_ActivityExecutor = activityExecutor ?? this;
     m_ActivityFactory  = activityFactory ?? this;
     m_Persister        = persister;
     Name    = name;
     m_Start = new GraphNode <TContext, EmptyActivity, object, object>("start", context => null, (context, o) => { });
     m_End   = new GraphNode <TContext, EndActivity, object, object>("end", context => null, (context, o) => { });
     registerNode(m_End);
 }
Example #2
0
 public Workflow(
     string name,
     IWorkflowPersister <TContext> persister,
     IActivityFactory activityFactory     = null,
     IExecutionObserver executionObserver = null)
     : this(
         persister,
         activityFactory,
         executionObserver)
 {
     Name = name ?? throw new ArgumentNullException(nameof(name));
 }
Example #3
0
 public Workflow(
     IWorkflowPersister <TContext> persister,
     IActivityFactory activityFactory     = null,
     IExecutionObserver executionObserver = null)
 {
     m_ExecutionObserver = executionObserver;
     m_ActivityFactory   = activityFactory ?? this;
     m_Persister         = persister;
     m_Start             = new GraphNode <TContext>("start");
     m_End  = new GraphNode <TContext>("end");
     m_Fail = new GraphNode <TContext>("fail");
     RegisterNode(m_Start);
     RegisterNode(m_End);
     RegisterNode(m_Fail);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="WorkflowService"/> class.
        /// </summary>
        /// <param name="stateMachineService">The machine repository.</param>
        /// <param name="workflowPersister">The workflow persister.</param>
        /// <param name="domainContextRepository">The domain context repository.</param>
        public WorkflowService(
            IStateMachineService stateMachineService,
            IWorkflowPersister workflowPersister,
            IDomainContextRepository domainContextRepository)
        {
            if (stateMachineService == null)
            {
                throw new ArgumentNullException("stateMachineService");
            }
            if (workflowPersister == null)
            {
                throw new ArgumentNullException("workflowPersister");
            }

            _stateMachineService     = stateMachineService;
            _workflowPersister       = workflowPersister;
            _domainContextRepository = domainContextRepository;

            _stateField = GetStateMachineContextFieldInfo(CurrentStateFieldName);
        }