Termin36.LiteStateMachine 0.1.0

dotnet add package Termin36.LiteStateMachine --version 0.1.0                
NuGet\Install-Package Termin36.LiteStateMachine -Version 0.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Termin36.LiteStateMachine" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Termin36.LiteStateMachine --version 0.1.0                
#r "nuget: Termin36.LiteStateMachine, 0.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Termin36.LiteStateMachine as a Cake Addin
#addin nuget:?package=Termin36.LiteStateMachine&version=0.1.0

// Install Termin36.LiteStateMachine as a Cake Tool
#tool nuget:?package=Termin36.LiteStateMachine&version=0.1.0                

О проекте

Проект формирует библиотеку для построения машин конечных состояний (State Machine), с помощью которых возможно строить сложную модель поведения с реакцией на воздействия. Ценность библиотеки в простоте и независимости от окружения, благодаря чему ее можно без сомнений интегрировать например в слой домена (DDD)

Пример использования

StateMachine<State, Trigger> stateMachine = new StateMachine<State, Trigger>(State.StateA);

stateMachine.Configuration(State.StateA)
    .OnAction(_triggerRegister, RegistrationPeople);
    .ChangeState(_triggerMove, State.StateMoving);

stateMachine.Configuration(State.StateMoving)
    .ChangeStateIf(_triggerRegister, State.StateA, IsAllowRegistration, "Регистрировать пользователей сейчас нельзя");

stateMachine.ValidateStateMachine();

await stateMachine.Fire(_triggerRegister, new People("Иванов", "Иван");
await stateMachine.Fire(_triggerMove, null);
await stateMachine.Fire(_triggerRegister, new People("Петров", "Петр"); // сработает исключение, так как обработать нельзя

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.0 1 2/1/2024
0.1.0-alpha 1 2/2/2024