Repository navigation
4.1. Events
Events are messages delivered to Stateflows behaviors. A CLR event is represented by a .NET type; its properties define the event data contract. Use ordinary classes, records, structs, or interfaces as appropriate for the application.
using Stateflows.Common;
[Event("orders.confirmed")]
public sealed record ConfirmOrder(string OrderId, int Quantity);[Event] assigns a stable name to a CLR event type; when omitted, Stateflows derives the name according to its event naming policy. CLR event names identify the type-based contract. For runtime-defined, string-name-distinct contracts whose fields are registered in Stateflows, use Payloads instead.
Behaviors receive events through their normal event-processing APIs. State Machines can use event types as transition triggers, Activities can accept event types at Accept Event nodes, Actions can register consumed event types, and Entities can use event types for initializers and mutations. See Messaging Patterns for send, dispatch, request/response, and notification semantics.
Requests are events that implement IRequest<TResponse>. Their response contract is a CLR type; name-based payload requests can instead declare either a registered payload response or a CLR response type. See Payloads.
Stateflows also defines system events for framework operations such as initialization, reset, and status requests. Application event types should not impersonate those system contracts.
Home page Support Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0. © by Mikołaj Milewski, 2026