File tree Expand file tree Collapse file tree
articles/azure-functions/durable Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,32 +56,18 @@ public static class MyFunctions
5656#### Class-based example
5757
5858``` csharp
59- [DurableTask (nameof (MyActivity ))]
60- public class MyActivity : TaskActivity <string , string >
59+ [Function (nameof (MyOrchestration ))]
60+ public static async Task < string > MyOrchestration (
61+ [OrchestrationTrigger ] TaskOrchestrationContext context )
6162{
62- private readonly ILogger logger ;
63-
64- public MyActivity (ILogger <MyActivity > logger ) // activities have access to DI.
65- {
66- this .logger = logger ;
67- }
68-
69- public async override Task <string > RunAsync (TaskActivityContext context , string input )
70- {
71- // implementation
72- }
63+ string input = context .GetInput <string >()! ;
64+ return await context .CallActivityAsync <string >(nameof (MyActivity ), input );
7365}
7466
75- [DurableTask (nameof (MyOrchestration ))]
76- public class MyOrchestration : TaskOrchestrator < string , string >
67+ [Function (nameof (MyActivity ))]
68+ public static string MyActivity ([ ActivityTrigger ] string input )
7769{
78- public async override Task <string > RunAsync (TaskOrchestrationContext context , string input )
79- {
80- ILogger logger = context .CreateReplaySafeLogger <MyOrchestration >(); // orchestrations do NOT have access to DI.
81-
82- // An extension method was generated for directly invoking "MyActivity".
83- return await context .CallMyActivityAsync (input );
84- }
70+ return $" Processed: {input }" ;
8571}
8672```
8773
You can’t perform that action at this time.
0 commit comments