Skip to content

Commit 459280a

Browse files
committed
Use VersioningSettings.CompareVersions in the sample
1 parent 2e70c35 commit 459280a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ public static async Task<string> ProcessOrder(
197197
# [C# (Isolated)](#tab/csharp-isolated)
198198

199199
```csharp
200+
using DurableTask.Core.Settings;
201+
200202
[Function("ProcessOrderOrchestrator")]
201203
public static async Task<string> ProcessOrder(
202204
[OrchestrationTrigger] TaskOrchestrationContext context)
@@ -205,12 +207,12 @@ public static async Task<string> ProcessOrder(
205207

206208
await context.CallActivityAsync("ValidateOrder", orderId);
207209

208-
if (context.Version == "1.0")
210+
if (VersioningSettings.CompareVersions(context.Version, "1.0") <= 0)
209211
{
210212
// Preserve original logic for existing instances
211213
await context.CallActivityAsync("ProcessPayment", orderId);
212214
}
213-
else // version 2.0 and later
215+
else // a higher version (including 2.0)
214216
{
215217
// New logic with discount processing (replaces payment processing)
216218
await context.CallActivityAsync("ApplyDiscount", orderId);

0 commit comments

Comments
 (0)