biz.dfch.CS.StateMachine NuGet Package

biz.dfch.CS.StateMachine
========================

A simple C# based State Machine that can be configured via State Transitions based on an idea by [Juliet](http://stackoverflow.com/users/40516/juliet) "[Simple state machine example in C#?](http://stackoverflow.com/questions/5923767/simple-state-machine-example-in-c)"

# DESCRIPTION

The project contains an extendable StateMachine that defines a few simple states and two conditions ("Continue", "Cancel") that can be used to advance (transition) through that state machine.

When instatiating the StateMachine with the default constructor the following states, conditions and transitions will be set up per default

## States

* Running
* InternalErrorState
* Completed
* Cancelled
* Disposed


## Conditions

* Continue
* Cancel


## Transitions

Source state | Condition | Target state
:-----|:-----|:------
Created | Continue | Running
Created | Cancel | InternalErrorState
Running | Continue | Completed
Running | Cancel | Cancelled
Completed | Continue | Disposed
Completed | Cancel | InternalErrorState
Cancelled | Continue | Disposed
Cancelled | Cancel | InternalErrorState
InternalErrorState | Continue | Disposed


## Basic functionalities

1.

The [`Continue`](./biz.dfch.CS.StateMachine/StateMachine.cs#L94) condition makes a transition from an arbitrary state to the next state as the "good case"
1. The [`Cancel`](./biz.dfch.CS.StateMachine/StateMachine.cs#L02) condition makes a transition from an arbitrary state to the next state as the "bad case"
1.

Furthermore there is the [`GetNext`](./biz.dfch.CS.StateMachine/StateMachine.cs#L306) method to transit to the next state based on a given condition.

There are as well methods for exporting and importing the configuration along with the states:

* [`GetStringRepresentation()`](https://github.com/dfensgmbh/biz.dfch.CS.StateMachine/blob/master/biz.dfch.CS.StateMachine/StateMachine.cs#L345)
* [`SetupStateMachine(String configuration, String currentState = null, String previousState = null)`](https://github.com/dfensgmbh/biz.dfch.CS.StateMachine/blob/master/biz.dfch.CS.StateMachine/StateMachine.cs#L135).




Got any biz.dfch.CS.StateMachine Question?





Info

Version: 1.2.2
Author(s): d-fens GmbH
Last Update: Monday, January 4, 2016
.NET Fiddle: Create the first Fiddle
Project Url: https://github.com/dfensgmbh/biz.dfch.CS.StateMachine
NuGet Url: https://www.nuget.org/packages/biz.dfch.CS.StateMachine


Install
Install-Package biz.dfch.CS.StateMachine
dotnet add package biz.dfch.CS.StateMachine
paket add biz.dfch.CS.StateMachine
biz.dfch.CS.StateMachine Download (Unzip the "nupkg" after downloading)

1 package depend on this package.


Tags



STATS

must-have-score

1.9

avg-downloads-per-day

1

days-since-last-release

3259