-
Notifications
You must be signed in to change notification settings - Fork 1
Overview
Stateflows framework is .NET toolkit to implement UML-based, executable Behaviors: Actions, State Machines, and Activities. It aims to help developers in building process-based business applications.
Stateflows concept is based on virtual actor model: each Behavior instance executes independently in reaction to incoming messages (called Events). Way the Behavior is processing Events is determined by its definition, expressed in pure C# code using UML-based State Machine or Activity notation.
Stateflows provides various ways of communication with Behavior instances, all message-oriented and based on Events that can be of any type:
-
Behavior instances can receive Events sent to them by the clients, they can also send Events to other instances and to themselves,
-
Event implementing
IRequest<>interface is a request and Behavior instance which receives it can provide a response to it, -
Behavior instances also can publish notification Events - clients and other instances can subscribe to them.
Each Behavior instance is uniquely addressed and able to keep its own independent state between calls. This state consists of current configuration of State Machine or Activity, but also Context Values which are available for developers implementing Behavior's logic.
Beside Events that are sent to Behavior instances by user code, Stateflows supports automatically send Time Events. This natively introduces scheduling in State Machines and Activities.
Stateflows architecture is storage-agnostic and state of Behavior instances can be kept using various data storage vendors. Currently two storage providers are available as separate NuGet packages:
Behavior instances can be communicated with within the process which hosts them, but there are also options to contact them remotely - from other backend processes as well as from frontend applications. Currently one transport provider is implemented as separate NuGet packages:
Stateflows framework can be extended in various ways. Following extensions are available as separate NuGet packages:
- PlantUML for State Machine and Activity visualizations,
- OneOf to enable State Machine Transition to be triggered by multiple Event types,
- DistributedLock to ensure Behavior instances consistency in clusted environments,
- FluentValidation to enable developers to validate incoming Events using FluentValidation library.
Stateflows can be used in clustered environments only if there is a way to ensure that each Behavior instance is executing exclusively. This can be achieved by using DistributedLock extension.
Stateflows can be used in multi-tenant environments, the requirement is to implement integration according to the guideline.
Stateflows is used by following companies:
Home page Support Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0. © by Mikołaj Milewski, 2025
Overview
Installation
Behaviors
State Machines
Building blocks
States
State
Composite State
Orthogonal State
Final State
Pseudostates
Choice
Junction
Fork
Join
Transitions
Transition
Default Transition
Internal Transition
Concepts
Evaluation of Transitions
Activities
Building blocks
Nodes
Action Node
Decision Node
Merge Node
Initial Node
Final Node
Input Node
Output Node
Fork Node
Join Node
Accept Event Action Node
Send Event Action Node
Data Store Node
Structured Activity Node
Iterative Activity Node
Parallel Activity Node
Flows
Data Flow
Control Flow
Concepts
Implicit fork and join
Actions
