Example #1
0
 /// <summary>
 /// Selects an event that is accepted during the specified state
 /// </summary>
 /// <typeparam name="TWorkflow"></typeparam>
 /// <typeparam name="TInstance"></typeparam>
 /// <param name="stateConfigurator"></param>
 /// <param name="eventExpression"></param>
 /// <returns></returns>
 public static ActivityConfigurator <TWorkflow, TInstance> When <TWorkflow, TInstance>(
     this StateConfigurator <TWorkflow, TInstance> stateConfigurator, Expression <Func <TWorkflow, Event> > eventExpression)
     where TWorkflow : class
     where TInstance : class
 {
     return(stateConfigurator.When(eventExpression, DoNothing));
 }
 public static ActivityConfigurator <IServiceWorkflow, IServiceController, RestartService> AcceptRestart(
     this StateConfigurator <IServiceWorkflow, IServiceController> configurator)
 {
     return(configurator
            .When(e => e.Restart)
            .TransitionTo(s => s.StoppingToRestart)
            .Then(i => i.Stop));
 }
 public static ActivityConfigurator <IServiceWorkflow, IServiceController, ServiceFault> AcceptFault(
     this StateConfigurator <IServiceWorkflow, IServiceController> configurator)
 {
     return(configurator
            .When(e => e.OnFaulted)
            .LogFault()
            .TransitionTo(s => s.Faulted));
 }
 public static ActivityConfigurator <IServiceWorkflow, IServiceController, PauseService> AcceptPause(
     this StateConfigurator <IServiceWorkflow, IServiceController> configurator)
 {
     return(configurator
            .When(e => e.Pause)
            .TransitionTo(s => s.Pausing)
            .Then(i => i.Pause));
 }