Ejemplo n.º 1
0
        // injected storage provider
        public Copier([PersistentState("copier")] IStorage <CopierState> storage)
        {
            this.storage = storage;

            var supervision = new Supervision(this);

            var fsm = new StateMachine()
                      .State(Active, supervision.On)
                      .Substate(Preparing, Trait.Of(Restartable), Durable)
                      .Substate(Copying, Trait.Of(Restartable, Cancellable), Durable)
                      .Substate(Restarting, Durable)
                      .Substate(Suspended)
                      .State(Inactive, supervision.Off)
                      .Substate(Initial)
                      .Substate(Completed, Trait.Of(Restartable), Durable)
                      .Substate(Canceled, Trait.Of(Restartable), Durable);

            behavior = new Behavior(fsm);
        }