Skip to content
This repository has been archived by the owner on May 31, 2023. It is now read-only.

Latest commit

 

History

History
69 lines (44 loc) · 2.96 KB

README.md

File metadata and controls

69 lines (44 loc) · 2.96 KB

biz.dfch.CS.StateMachine

Build Status License

A simple C# based State Machine that can be configured via State Transitions based on an idea by Juliet "Simple state machine example in C#?"

You can download this package via NuGet with Install-Package biz.dfch.CS.StateMachine.

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
InitialState Continue Running
InitialState 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 condition makes a transition from an arbitrary state to the next state as the "good case"
  2. The Cancel condition makes a transition from an arbitrary state to the next state as the "bad case"
  3. Furthermore there is the GetNext 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:

Release Notes

1.2.0 20150926

  • adjust namespace
  • States and Conditions can now be retrieved by consumer
  • added code contracts pre-conditions
  • enabled CodeContracts assemlby

TeamCity Logo

Built and released with TeamCity