StepWise: A Powerful C# Workflow Engine for Task Execution
Xiaoyun Zhang
Posted on November 7, 2024
What is StepWise
StepWise is a workflow engine that lets C# developers:
- Code workflows in C#
- View & Run workflow in Browser
Quick links
- 📦 GitHub Repository
- 📚 Examples
- 📘 Documentation
- 📊 NuGet Package
- 🎨 StepWise Gallery
What Makes StepWise Special?
StepWise stands out by combining the power of C# with a simple, declarative approach to defining workflows. It automatically handles dependency resolution and parallel execution, making it perfect for scenarios where you need to coordinate multiple tasks efficiently.
How It Works
Here's a simple example that demonstrates StepWise's elegance. Let's say you're building a dinner preparation workflow:
// PrepareDinner.cs
public class PrepareDinner
{
[Step]
public async Task<string> ChopVegetables(string[] vegetables)
{
await Task.Delay(3000);
return $"Chopped {string.Join(", ", vegetables)}";
}
[Step]
public async Task<string> BoilWater()
{
await Task.Delay(2000);
return "Boiled water";
}
[Step]
[DependOn(nameof(ChopVegetables))]
[DependOn(nameof(BoilWater))]
public async Task<string> ServeDinner(
[FromStep(nameof(ChopVegetables))] string[] vegetables,
[FromStep(nameof(BoilWater))] string water)
{
return "Dinner ready!";
}
}
The magic happens through simple attributes:
-
[Step]
marks methods as workflow steps -
[DependOn]
defines dependencies between steps -
[FromStep]
passes outputs from one step to another
This creates the following workflow in browser
You can find out more examples in StepWise Repo
Getting Started
Install StepWise via NuGet:
dotnet add package LittleLittleCloud.StepWise
Install Gallery Samples
StepWise provides a list of Gallery samples for you to try out. To install gallery samples, simply run the following command:
dotnet add package LittleLittleCloud.StepWise.Gallery
Posted on November 7, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.