The documentation you are viewing is for Dapr v1.18 which is an older version of Dapr. For up-to-date documentation, see the latest version.

Workflow

Dapr.Workflow brings durable, long-running orchestration to .NET applications. Workflows are expressed as C# classes that orchestrate sequences of activities — each activity is a discrete unit of work that can call other Dapr building blocks, and the workflow runtime handles persistence, replay, and recovery automatically. If a process restarts mid-workflow, the runtime replays the event log to reconstruct state and resume execution.

Workflows and activities are registered with dependency injection via AddDaprWorkflow(). Starting with the v1.18 SDK, a build-time source generator discovers and registers all workflow and activity types automatically, so you no longer need to call RegisterWorkflow<T> or RegisterActivity<T> by hand, though doing so is still fully supported. The DaprWorkflowClient is then injected to schedule, manage, and inspect running workflow instances.

Core concepts

  • DaprWorkflowClient registration and lifetime: dependency injection with singleton, scoped, or transient lifetimes, injecting services into activities, and using the replay-safe logger.
  • Workflow versioning: patch-based and name-based versioning strategies, cross-assembly workflow discovery, and override attributes.
  • Workflow serialization: overriding the default System.Text.Json settings and registering custom serializers (e.g. MessagePack).
  • Multi-application workflows: calling activities and child workflows hosted in a different Dapr application.
  • Workflow management operations: schedule, retrieve status, raise events, suspend, resume, terminate, and purge workflow instances with DaprWorkflowClient.
  • Workflow history propagation: opt-in per-call propagation of workflow history to child workflows and activities, querying propagated history, and security considerations.
  • Workflow examples: links to runnable tutorials in the Dapr Quickstarts repository and example projects in the .NET SDK repository.

Next steps