Skip to content

Commit 4985c95

Browse files
committed
Remove .NET in-proc
Clarify the `context.Version == null` case Clarify a note in "What Happens After Deployment"
1 parent 2c7b442 commit 4985c95

File tree

1 file changed

+3
-75
lines changed

1 file changed

+3
-75
lines changed

articles/azure-functions/durable/durable-functions-orchestration-versioning.md

Lines changed: 3 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -74,27 +74,6 @@ To implement version-aware logic in your orchestrator function, you can use the
7474
> [!IMPORTANT]
7575
> When implementing version-aware logic, it's **critically important** to preserve the exact orchestration logic for older versions. Any changes to the sequence, order, or signature of activity calls for existing versions may break deterministic replay and cause in-flight orchestrations to fail or produce incorrect results. The old version code paths must remain unchanged once deployed.
7676
77-
# [C# (In-process)](#tab/csharp)
78-
79-
```csharp
80-
[FunctionName("MyOrchestrator")]
81-
public static async Task<string> RunOrchestrator(
82-
[OrchestrationTrigger] IDurableOrchestrationContext context)
83-
{
84-
if (context.Version == "1.0")
85-
{
86-
// Original logic for version 1.0
87-
...
88-
}
89-
else if (context.Version == "2.0")
90-
{
91-
// New logic for version 2.0
92-
...
93-
}
94-
...
95-
}
96-
```
97-
9877
# [C# (Isolated)](#tab/csharp-isolated)
9978

10079
```csharp
@@ -119,7 +98,7 @@ public static async Task<string> RunOrchestrator(
11998
---
12099

121100
> [!TIP]
122-
> If you're just starting to use Orchestration Versioning and you already have in-flight orchestrations that were created before you specified a `defaultVersion`, it's not too late! Feel free to add the `defaultVersion` setting to your `host.json` now. For all previously created orchestrations, `context.Version` returns `null` (or an equivalent language-dependent value), so you can structure your orchestrator logic to handle both the legacy (null version) and new versioned orchestrations accordingly.
101+
> If you're just starting to use Orchestration Versioning and you already have in-flight orchestrations that were created before you specified a `defaultVersion`, it's not too late! Feel free to add the `defaultVersion` setting to your `host.json` now. For all previously created orchestrations, `context.Version` returns `null` (or an equivalent language-dependent value), so you can structure your orchestrator logic to handle both the legacy (null version) and new versioned orchestrations accordingly. In C#, you can check for `context.Version == null` or `context.Version is null` to handle the legacy case. Please also note that specifying `"defaultVersion": null` in `host.json` is equivalent to not specifying it at all.
123102
124103
> [!TIP]
125104
> Depending on your situation, you may prefer branching on different levels. You can make a local change precisely where this change is required, like the example shows. Alternatively, you can branch at a higher level, even at the entire orchestrator implementation level, which introduces some code duplication, but may keep the execution flow clear. It's up to you to choose the approach that best fits your scenario and coding style.
@@ -137,7 +116,7 @@ Here's what to expect once you deploy your updated orchestrator function with th
137116
4. **Old Worker Restrictions**: Old workers will be allowed to process only the orchestrations with a version _equal to or lower_ than the version specified in their own `defaultVersion` in `host.json`, because they aren't expected to have orchestrator code compatible with newer versions. This restriction prevents execution errors and unexpected behavior.
138117

139118
> [!NOTE]
140-
> This behavior targets the most common situations, and this is what the default configuration provides. However, it can be modified if needed (see [Advanced usage](#advanced-usage) for details).
119+
> The behavior described in this section targets the most common situations, and this is what the default configuration provides. However, it can be modified if needed (see [Advanced usage](#advanced-usage) for details).
141120
142121

143122
### Example: Replacing an Activity in the Sequence
@@ -159,23 +138,6 @@ This example shows how to replace one activity with a different activity in the
159138

160139
**Orchestrator function:**
161140

162-
# [C# (In-process)](#tab/csharp)
163-
164-
```csharp
165-
[FunctionName("ProcessOrderOrchestrator")]
166-
public static async Task<string> ProcessOrder(
167-
[OrchestrationTrigger] IDurableOrchestrationContext context)
168-
{
169-
var orderId = context.GetInput<string>();
170-
171-
await context.CallActivityAsync("ValidateOrder", orderId);
172-
await context.CallActivityAsync("ProcessPayment", orderId);
173-
await context.CallActivityAsync("ShipOrder", orderId);
174-
175-
return "Order processed successfully";
176-
}
177-
```
178-
179141
# [C# (Isolated)](#tab/csharp-isolated)
180142

181143
```csharp
@@ -210,35 +172,6 @@ public static async Task<string> ProcessOrder(
210172

211173
**Orchestrator function:**
212174

213-
# [C# (In-process)](#tab/csharp)
214-
215-
```csharp
216-
[FunctionName("ProcessOrderOrchestrator")]
217-
public static async Task<string> ProcessOrder(
218-
[OrchestrationTrigger] IDurableOrchestrationContext context)
219-
{
220-
var orderId = context.GetInput<string>();
221-
222-
await context.CallActivityAsync("ValidateOrder", orderId);
223-
224-
if (context.Version == "1.0")
225-
{
226-
// Preserve original logic for existing instances
227-
await context.CallActivityAsync("ProcessPayment", orderId);
228-
}
229-
else // version 2.0 and later
230-
{
231-
// New logic with discount processing (replaces payment processing)
232-
await context.CallActivityAsync("ApplyDiscount", orderId);
233-
await context.CallActivityAsync("ProcessPaymentWithDiscount", orderId);
234-
}
235-
236-
await context.CallActivityAsync("ShipOrder", orderId);
237-
238-
return "Order processed successfully";
239-
}
240-
```
241-
242175
# [C# (Isolated)](#tab/csharp-isolated)
243176

244177
```csharp
@@ -344,10 +277,6 @@ By default, all new orchestration instances are created with the current `defaul
344277

345278
You can override the default version by providing a specific version value when creating new orchestration instances using the orchestration client APIs. This allows fine-grained control over which version each new orchestration instance uses.
346279

347-
# [C# (In-process)](#tab/csharp)
348-
349-
This feature is not supported in the in-process model.
350-
351280
# [C# (Isolated)](#tab/csharp-isolated)
352281

353282
```csharp
@@ -424,8 +353,7 @@ Over time, you may want to remove legacy code paths from your orchestrator funct
424353

425354
- **Issue**: Version information isn't available in orchestrator
426355
- **Solution**: Verify that you're using a supported language and a Durable Functions extension version that supports Orchestration Versioning:
427-
- For .NET Isolated, use `Microsoft.Azure.Functions.Worker.Extensions.DurableTask` version **1.5.0** or later.
428-
- For .NET In-process, use `Microsoft.Azure.WebJobs.Extensions.DurableTask` version **3.3.0** or later.
356+
- For .NET Isolated, use `Microsoft.Azure.Functions.Worker.Extensions.DurableTask` version **1.5.0** or later.
429357

430358
## Next steps
431359

0 commit comments

Comments
 (0)