Exemple #1
0
        public static MessageExceptionConfigurator <TWorkflow, TInstance, TBody> InCaseOf <TWorkflow, TInstance, TBody>(
            this ActivityConfigurator <TWorkflow, TInstance, TBody> activityConfigurator)
            where TWorkflow : class
            where TInstance : class
        {
            var configurator = new MessageExceptionConfiguratorImpl <TWorkflow, TInstance, TBody>(activityConfigurator);

            activityConfigurator.AddConfigurator(configurator);

            return(configurator);
        }
Exemple #2
0
        public static ActivityConfigurator <TWorkflow, TInstance, TBody> Then <TWorkflow, TInstance, TBody>(
            this ActivityConfigurator <TWorkflow, TInstance, TBody> activityConfigurator, Action <TInstance> action)
            where TWorkflow : class
            where TInstance : class
        {
            var configurator = new DelegateInstanceConfigurator <TWorkflow, TInstance>(action);

            activityConfigurator.AddConfigurator(configurator);

            return(activityConfigurator);
        }
Exemple #3
0
        /// <summary>
        /// Transition the state machine workflow to the Final state
        /// </summary>
        /// <typeparam name="TWorkflow"></typeparam>
        /// <typeparam name="TInstance"></typeparam>
        /// <param name="activityConfigurator"></param>
        /// <returns></returns>
        public static ActivityConfigurator <TWorkflow, TInstance> Finalize <TWorkflow, TInstance>(
            this ActivityConfigurator <TWorkflow, TInstance> activityConfigurator)
            where TWorkflow : class
            where TInstance : class
        {
            var configurator = new TransitionConfigurator <TWorkflow, TInstance>(StateMachineWorkflow.FinalStateName);

            activityConfigurator.AddConfigurator(configurator);

            return(activityConfigurator);
        }
Exemple #4
0
        public static ActivityConfigurator <TWorkflow, TInstance, TBody> Then <TWorkflow, TInstance, TBody>(
            this ActivityConfigurator <TWorkflow, TInstance, TBody> activityConfigurator,
            Expression <Func <TInstance, Action <TBody> > > methodExpression)
            where TWorkflow : class
            where TInstance : class
        {
            var configurator = new MethodBodyConfigurator <TWorkflow, TInstance, TBody>(methodExpression);

            activityConfigurator.AddConfigurator(configurator);

            return(activityConfigurator);
        }
        public static ActivityConfigurator <TWorkflow, TInstance, TBody> TransitionTo <TWorkflow, TInstance, TBody>(
            this ActivityConfigurator <TWorkflow, TInstance, TBody> activityConfigurator,
            Expression <Func <TWorkflow, State> > targetStateExpression)
            where TWorkflow : class
            where TInstance : class
        {
            var configurator = new TransitionConfigurator <TWorkflow, TInstance>(targetStateExpression);

            activityConfigurator.AddConfigurator(configurator);

            return(activityConfigurator);
        }
Exemple #6
0
        public static ActivityConfigurator <TWorkflow, TInstance, Request <TRequest> > Respond
        <TWorkflow, TInstance, TRequest>(
            this ActivityConfigurator <TWorkflow, TInstance, Request <TRequest> > activityConfigurator)
            where TWorkflow : class
            where TInstance : class
        {
            var configurator =
                new DelegateInstanceBodyConfigurator <TWorkflow, TInstance, Request <TRequest> >((instance, request) =>
            {
                request.Respond();
            });

            activityConfigurator.AddConfigurator(configurator);

            return(activityConfigurator);
        }
Exemple #7
0
        public static ActivityConfigurator <TWorkflow, TInstance, Request <TRequest> > Respond
        <TWorkflow, TInstance, TRequest, TResponse>(
            this ActivityConfigurator <TWorkflow, TInstance, Request <TRequest> > activityConfigurator,
            Func <Request <TRequest>, TResponse> getResponse)
            where TWorkflow : class
            where TInstance : class
        {
            var configurator =
                new DelegateInstanceBodyConfigurator <TWorkflow, TInstance, Request <TRequest> >((instance, request) =>
            {
                TResponse response = getResponse(request);

                request.Respond(response);
            });

            activityConfigurator.AddConfigurator(configurator);

            return(activityConfigurator);
        }