Repository navigation
Activity Data Flow
An object flow carries typed tokens between Activity nodes. In UML diagrams it is normally shown as a directed edge, optionally labeled with the carried object. In Stateflows, declare its token type with AddFlow<TToken>(target).
Action nodes publish values with Output or OutputRange; downstream actions read the values selected for their activation with GetTokensOfType<TToken>().
.AddAction(
"CreateOrder",
async c => c.Output(new Order("ORD-42", [new Item("Book", 12m, 2)])),
node => node.AddFlow<Order>("CalculateTotal"))
.AddAction(
"CalculateTotal",
async c =>
{
var order = c.GetTokensOfType<Order>().Single();
c.Output(order.Items.Sum(item => item.Price * item.Quantity));
},
node => node.AddFlow<decimal>("DisplayTotal"))
.AddAction(
"DisplayTotal",
async c =>
{
var total = c.GetTokensOfType<decimal>().Single();
await display.ShowAsync(total, c.CancellationToken);
})The TToken on the flow selects the source token type. Without a transformation, that is also the type delivered to the target. A transformation can change it: for example, AddFlow<Order>("DisplayTotal", f => f.AddTransformation(async c => c.Token.Items.Sum(item => item.Price * item.Quantity))) delivers a decimal instead of an Order. The target must consume the transformed type. A guard that returns false prevents that token from traversing the flow.
Tokens are separate from control flow. Use AddControlFlow for sequencing without data. See Tokens, Flows, Input Node, and Output Node.
public sealed record Item(string Name, decimal Price, int Quantity);
public sealed record Order(string Id, IReadOnlyList<Item> Items);Home page Support Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0. © by Mikołaj Milewski, 2026
Overview
Installation
Runtimes
Orleans runtime
Concepts
Events and Structural Events
Messaging Patterns
Validation
Scheduling
Observability
Behaviors
Behavior Values
Dependency Injection
Behavioral Groups
State Machines
Concepts
State Identity
In-State Event Deferrals
Evaluation of Transitions
Exception Handling
Building blocks
Regions
States
State
Composite State
Orthogonal State
Final State
Pseudostates
Choice
Junction
Fork
Join
History
Transitions
Transition
Default Transition
Internal Transition
Activities
Concepts
Exception Handling
Implicit Fork and Join
Tokens
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
Publish Event Action Node
Time Event Action Node
Data Store Node
Structured Activity Node
Iterative Activity Node
Parallel Activity Node
Flows
Data Flow
Control Flow
Actions
Entities
Fields
Mutations
Projections
Extensions
ClearScript
FluentValidation
JSON definitions
Minimal APIs
OneOf
OpenTelemetry
PlantUML
Scheduling