Durable Execution and Workflows in .NET
Study Session by: [email protected] — October 28, 2026 — 6m
Imagine you are baking a complicated chocolate cake with ten different steps.
Normally, a computer program is like a chef with the memory of a goldfish. If the power blinks out for just one second while the chef is on Step 7, they completely forget who they are, what they were doing, and what is already in the bowl. You have to throw everything in the trash, turn the oven off, and start all over from Step 1.
Durable Execution solves this problem by giving the chef a magic notebook.
Every time the chef finishes a step—like cracking the eggs or stirring the sugar—they write it down in the notebook: "Step 3 finished: Eggs added."
If a lightning bolt hits the kitchen and the power goes out, the chef wakes up, opens the notebook, sees that Step 3 is done, and immediately starts Step 4. Nothing is thrown away, no time is wasted, and the cake turns out perfect.
In the world of .NET, Microsoft created tools like the Durable Task Framework (often used through Azure Durable Functions) to give your C# code this exact superpower.
How Does It Work in .NET?
In a regular .NET app, if your server crashes or restarts, whatever function was running disappears from memory.
With durable execution, your program is split into two roles:
- The Orchestrator (The Master Chef): This is a function that simply reads the checklist. It says: "First, run Step A. When that's done, run Step B. Then wait three days, and run Step C."
- The Activities (The Kitchen Helpers): These are the small jobs that do the actual heavy lifting, like charging a credit card or sending an email.
Every time an activity finishes, .NET saves a tiny bookmark into a database. If the server suddenly catches fire, .NET moves your code to a new computer, reads the bookmarks, and picks up right where it left off!
Real-World Examples: What Kinds of Apps Use This?
Here are three common types of apps built with the Durable Task Scheduler in .NET:
1. The Video Game Store (Multi-Step Checkout)
Imagine you are buying a game on an online store:
- Step 1: Charge your credit card.
- Step 2: Generate a game license key.
- Step 3: Send an email receipt.
What happens if the power cuts out between Step 1 and Step 2? Without durable execution, you might get charged money, but never get your game!
With durable execution, the app knows Step 1 succeeded. As soon as the system recovers, it moves straight to Step 2 to generate your key.
2. Booking a Vacation (The Safety Net)
Say an app is booking a trip for you:
- Reserve a flight.
- Reserve a hotel room.
- Rent a car.
What if the flight and hotel succeed, but there are no rental cars left? A durable .NET app can run a "cleanup" sequence. It looks at the log, sees what succeeded, and automatically cancels the hotel and flight so you don't get charged for a trip you can't take.
3. Asking the Boss for Permission (Long Pauses)
Imagine an app where an employee requests a new $1,000 laptop. A manager has to click "Approve" in an email before the company buys it.
- A human might take four days to open that email!
- Normal computer programs hate waiting. Keeping a program paused for four days wastes electricity and server memory.
- With durable execution, the .NET app puts itself to "sleep." It saves its state, shuts down completely (costing almost $0), and wakes up days later only when the manager clicks the button.
A Quick Question for You
Does the difference between a normal program and a "durable" program make sense?
To make sure we've got the concept down: Can you think of something you do on your phone that takes several steps and would be really annoying if it reset to the beginning halfway through?
Sources:
This session also includes:
Enjoyed this session?
Create your own AI-powered study sessions — generate quizzes, flashcards and notes automatically. Free to start.
Log in to leave a comment.