Skip to content

5.5.2.1.4. Initial Node

Mikołaj Milewski edited this page Nov 12, 2026 · 1 revision

Initial Node

An Initial Node identifies an Activity's entry point. It has no incoming flow and emits control along its outgoing flows when the Activity execution is initialized. UML notation is a small filled circle.

Definition

.AddInitial(initial => initial
    .AddControlFlow("LoadOrder"))
.AddAction(
    "LoadOrder",
    async c => c.Output(await orders.LoadAsync(
        orderId, c.CancellationToken)),
    node => node.AddFlow<Order>("CheckInventory"))
.AddAction("CheckInventory", async c =>
    await inventory.CheckAsync(
        c.GetTokensOfType<Order>().Single(), c.CancellationToken))

Stateflows permits one Initial Node per Activity scope; repeated AddInitial calls in that scope are rejected. Its registered name is automatically {parentName}.initial (the Activity name at the root, or the containing node's name in a nested scope). Give that node multiple outgoing control flows when initialization should enable several paths. A nested structured Activity has its own scope and may declare its own Initial Node.

An Input Pin instead routes incoming application tokens. A path driven solely by input tokens can start from Input without Initial; use initial control when work must begin during initialization independently of supplied tokens. See Final Node and Activities.

Clone this wiki locally