WorkFlowEngin 0.1.0
dotnet add package WorkFlowEngin --version 0.1.0
NuGet\Install-Package WorkFlowEngin -Version 0.1.0
<PackageReference Include="WorkFlowEngin" Version="0.1.0" />
paket add WorkFlowEngin --version 0.1.0
#r "nuget: WorkFlowEngin, 0.1.0"
// Install WorkFlowEngin as a Cake Addin #addin nuget:?package=WorkFlowEngin&version=0.1.0 // Install WorkFlowEngin as a Cake Tool #tool nuget:?package=WorkFlowEngin&version=0.1.0
StateMachineLibrary
StateMachineLibrary is a flexible and extensible .NET library for managing state transitions in applications. It allows users to define states, transitions, triggers, and associated actions, making it ideal for workflows, approvals, or other state-dependent processes.
Features
Fluent API for defining states, transitions, and triggers.
Trigger-based actions: Evaluate conditions and execute actions seamlessly.
Database integration: Save state transitions to a database.
Dynamic configuration: Define and update states or triggers programmatically.
Shortcomings & Limitations
Current Shortcomings:
- Basic Error Handling: Error handling is limited; exceptions may not provide detailed context.
- Validation: Limited checks exist to ensure the library is used correctly (e.g.,
Build
must be called before saving transitions). - Trigger Structure: While triggers are highly flexible, there's no enforced structure for the object passed to them (e.g., ensuring it contains
Notification
properties likeMessage
orStatus
). - Logging: The logging mechanism is simple and lacks advanced features like filtering logs by level (e.g.,
Info
,Debug
,Error
). - Concurrency: No explicit mechanisms exist to handle concurrency issues in a multi-threaded environment.
- Serialization: Triggers or transitions cannot be easily serialized out-of-the-box for storage or external usage.
Future Improvements:
- Add more robust validation mechanisms.
- Introduce default implementations for common use cases (e.g., notifications, logging).
- Support advanced logging with configurable log levels.
- Enable serialization for easier configuration sharing.
- Add ability to use data from other databases (files, mysql, etc)
Installation
You can install the library via NuGet:
dotnet add package StateMachineLibrary --version 1.0.0-alpha
Getting Started
Define a simple state transition
var stateMachine = StateMachineFactory.Create("data source=database connection");
var test = stateMachine.GetNextState(21);
stateMachine.PerformTransition(entities, request, all, (context, rec, nextState, related) =>
{
rec.StateId = nextState;
foreach(var e in related)
{
e.RequestCode = "it wrk";
}
context.SaveChanges();
});
Evaluate triggers
var myObject = new MyObject { IsReadyToPublish = true, Status = "Draft" };
stateMachine.EvaluateTriggers(myObject);
Contributing
Contributions are welcome! If you find a bug or have a feature request, please open an issue or submit a pull request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net471 is compatible. net472 was computed. net48 was computed. net481 was computed. |
-
- EntityFramework (>= 6.5.1)
- Microsoft.EntityFramework.SqlServer (>= 6.5.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.1.0 | 29 | 1/28/2025 |