diff --git a/src/Generators/DurableTaskSourceGenerator.cs b/src/Generators/DurableTaskSourceGenerator.cs index 986f7ec3..19a24cc9 100644 --- a/src/Generators/DurableTaskSourceGenerator.cs +++ b/src/Generators/DurableTaskSourceGenerator.cs @@ -325,6 +325,9 @@ static void AddOrchestratorFunctionDeclaration(StringBuilder sourceBuilder, Dura static void AddOrchestratorCallMethod(StringBuilder sourceBuilder, DurableTaskTypeInfo orchestrator) { sourceBuilder.AppendLine($@" + /// + /// Schedules a new instance of the orchestrator. + /// /// public static Task ScheduleNew{orchestrator.TaskName}InstanceAsync( this IOrchestrationSubmitter client, {orchestrator.InputParameter}, StartOrchestrationOptions? options = null) @@ -336,6 +339,9 @@ static void AddOrchestratorCallMethod(StringBuilder sourceBuilder, DurableTaskTy static void AddSubOrchestratorCallMethod(StringBuilder sourceBuilder, DurableTaskTypeInfo orchestrator) { sourceBuilder.AppendLine($@" + /// + /// Calls the sub-orchestrator. + /// /// public static Task<{orchestrator.OutputType}> Call{orchestrator.TaskName}Async( this TaskOrchestrationContext context, {orchestrator.InputParameter}, TaskOptions? options = null) @@ -347,6 +353,10 @@ static void AddSubOrchestratorCallMethod(StringBuilder sourceBuilder, DurableTas static void AddActivityCallMethod(StringBuilder sourceBuilder, DurableTaskTypeInfo activity) { sourceBuilder.AppendLine($@" + /// + /// Calls the activity. + /// + /// public static Task<{activity.OutputType}> Call{activity.TaskName}Async(this TaskOrchestrationContext ctx, {activity.InputParameter}, TaskOptions? options = null) {{ return ctx.CallActivityAsync<{activity.OutputType}>(""{activity.TaskName}"", input, options); @@ -356,6 +366,10 @@ static void AddActivityCallMethod(StringBuilder sourceBuilder, DurableTaskTypeIn static void AddActivityCallMethod(StringBuilder sourceBuilder, DurableFunction activity) { sourceBuilder.AppendLine($@" + /// + /// Calls the activity. + /// + /// public static Task<{activity.ReturnType}> Call{activity.Name}Async(this TaskOrchestrationContext ctx, {activity.Parameter}, TaskOptions? options = null) {{ return ctx.CallActivityAsync<{activity.ReturnType}>(""{activity.Name}"", {activity.Parameter.Name}, options); diff --git a/test/Generators.Tests/AzureFunctionsTests.cs b/test/Generators.Tests/AzureFunctionsTests.cs index 6ae9523d..d9d7fad0 100644 --- a/test/Generators.Tests/AzureFunctionsTests.cs +++ b/test/Generators.Tests/AzureFunctionsTests.cs @@ -27,6 +27,10 @@ public class Calculator string expectedOutput = TestHelpers.WrapAndFormat( GeneratedClassName, methodList: @" +/// +/// Calls the activity. +/// +/// public static Task CallIdentityAsync(this TaskOrchestrationContext ctx, int input, TaskOptions? options = null) { return ctx.CallActivityAsync(""Identity"", input, options); @@ -57,6 +61,10 @@ public class Calculator string expectedOutput = TestHelpers.WrapAndFormat( GeneratedClassName, methodList: @" +/// +/// Calls the activity. +/// +/// public static Task CallIdentityAsync(this TaskOrchestrationContext ctx, int input, TaskOptions? options = null) { return ctx.CallActivityAsync(""Identity"", input, options); @@ -92,6 +100,10 @@ public class Calculator string expectedOutput = TestHelpers.WrapAndFormat( GeneratedClassName, methodList: @" +/// +/// Calls the activity. +/// +/// public static Task CallIdentityAsync(this TaskOrchestrationContext ctx, AzureFunctionsTests.Input input, TaskOptions? options = null) { return ctx.CallActivityAsync(""Identity"", input, options); @@ -141,6 +153,10 @@ public class MyActivity : TaskActivity<{inputType}, {outputType}> string expectedOutput = TestHelpers.WrapAndFormat( GeneratedClassName, methodList: $@" +/// +/// Calls the activity. +/// +/// public static Task<{outputType}> CallMyActivityAsync(this TaskOrchestrationContext ctx, {inputType} input, TaskOptions? options = null) {{ return ctx.CallActivityAsync<{outputType}>(""MyActivity"", input, options); @@ -214,6 +230,9 @@ public class MyOrchestrator : TaskOrchestrator<{inputType}, {outputType}> .ContinueWith(t => ({outputType})(t.Result ?? default({outputType})!), TaskContinuationOptions.ExecuteSynchronously); }} +/// +/// Schedules a new instance of the orchestrator. +/// /// public static Task ScheduleNewMyOrchestratorInstanceAsync( this IOrchestrationSubmitter client, {expectedInputParameter}, StartOrchestrationOptions? options = null) @@ -221,6 +240,9 @@ public static Task ScheduleNewMyOrchestratorInstanceAsync( return client.ScheduleNewOrchestrationInstanceAsync(""MyOrchestrator"", input, options); }} +/// +/// Calls the sub-orchestrator. +/// /// public static Task<{outputType}> CallMyOrchestratorAsync( this TaskOrchestrationContext context, {expectedInputParameter}, TaskOptions? options = null) @@ -291,6 +313,9 @@ public abstract class MyOrchestratorBase : TaskOrchestrator<{inputType}, {output .ContinueWith(t => ({outputType})(t.Result ?? default({outputType})!), TaskContinuationOptions.ExecuteSynchronously); }} +/// +/// Schedules a new instance of the orchestrator. +/// /// public static Task ScheduleNewMyOrchestratorInstanceAsync( this IOrchestrationSubmitter client, {expectedInputParameter}, StartOrchestrationOptions? options = null) @@ -298,6 +323,9 @@ public static Task ScheduleNewMyOrchestratorInstanceAsync( return client.ScheduleNewOrchestrationInstanceAsync(""MyOrchestrator"", input, options); }} +/// +/// Calls the sub-orchestrator. +/// /// public static Task<{outputType}> CallMyOrchestratorAsync( this TaskOrchestrationContext context, {expectedInputParameter}, TaskOptions? options = null) @@ -493,6 +521,9 @@ public static Task MyOrchestrator([OrchestrationTrigger] TaskOrchestrati .ContinueWith(t => (string)(t.Result ?? default(string)!), TaskContinuationOptions.ExecuteSynchronously); }} +/// +/// Schedules a new instance of the orchestrator. +/// /// public static Task ScheduleNewMyOrchestratorInstanceAsync( this IOrchestrationSubmitter client, int input, StartOrchestrationOptions? options = null) @@ -500,6 +531,9 @@ public static Task ScheduleNewMyOrchestratorInstanceAsync( return client.ScheduleNewOrchestrationInstanceAsync(""MyOrchestrator"", input, options); }} +/// +/// Calls the sub-orchestrator. +/// /// public static Task CallMyOrchestratorAsync( this TaskOrchestrationContext context, int input, TaskOptions? options = null) @@ -507,6 +541,10 @@ public static Task CallMyOrchestratorAsync( return context.CallSubOrchestratorAsync(""MyOrchestrator"", input, options); }} +/// +/// Calls the activity. +/// +/// public static Task CallMyActivityAsync(this TaskOrchestrationContext ctx, int input, TaskOptions? options = null) {{ return ctx.CallActivityAsync(""MyActivity"", input, options); diff --git a/test/Generators.Tests/ClassBasedSyntaxTests.cs b/test/Generators.Tests/ClassBasedSyntaxTests.cs index d0cf51d5..c3abc6c5 100644 --- a/test/Generators.Tests/ClassBasedSyntaxTests.cs +++ b/test/Generators.Tests/ClassBasedSyntaxTests.cs @@ -31,6 +31,9 @@ class MyOrchestrator : TaskOrchestrator<{type}, string> string expectedOutput = TestHelpers.WrapAndFormat( GeneratedClassName, methodList: $@" +/// +/// Schedules a new instance of the orchestrator. +/// /// public static Task ScheduleNewMyOrchestratorInstanceAsync( this IOrchestrationSubmitter client, {input}, StartOrchestrationOptions? options = null) @@ -38,6 +41,9 @@ public static Task ScheduleNewMyOrchestratorInstanceAsync( return client.ScheduleNewOrchestrationInstanceAsync(""MyOrchestrator"", input, options); }} +/// +/// Calls the sub-orchestrator. +/// /// public static Task CallMyOrchestratorAsync( this TaskOrchestrationContext context, {input}, TaskOptions? options = null) @@ -80,6 +86,9 @@ abstract class MyOrchestratorBase : TaskOrchestrator string expectedOutput = TestHelpers.WrapAndFormat( GeneratedClassName, methodList: @" +/// +/// Schedules a new instance of the orchestrator. +/// /// public static Task ScheduleNewMyOrchestratorInstanceAsync( this IOrchestrationSubmitter client, int input, StartOrchestrationOptions? options = null) @@ -87,6 +96,9 @@ public static Task ScheduleNewMyOrchestratorInstanceAsync( return client.ScheduleNewOrchestrationInstanceAsync(""MyOrchestrator"", input, options); } +/// +/// Calls the sub-orchestrator. +/// /// public static Task CallMyOrchestratorAsync( this TaskOrchestrationContext context, int input, TaskOptions? options = null) @@ -129,6 +141,10 @@ class MyActivity : TaskActivity<{type}, string> string expectedOutput = TestHelpers.WrapAndFormat( GeneratedClassName, methodList: $@" +/// +/// Calls the activity. +/// +/// public static Task CallMyActivityAsync(this TaskOrchestrationContext ctx, {input}, TaskOptions? options = null) {{ return ctx.CallActivityAsync(""MyActivity"", input, options); @@ -169,6 +185,10 @@ public class MyClass { } string expectedOutput = TestHelpers.WrapAndFormat( generatedClassName: "GeneratedDurableTaskExtensions", methodList: @" +/// +/// Calls the activity. +/// +/// public static Task CallMyActivityAsync(this TaskOrchestrationContext ctx, MyNS.MyClass input, TaskOptions? options = null) { return ctx.CallActivityAsync(""MyActivity"", input, options); @@ -211,6 +231,10 @@ public class MyClass { } string expectedOutput = TestHelpers.WrapAndFormat( GeneratedClassName, methodList: @" +/// +/// Calls the activity. +/// +/// public static Task CallMyActivityAsync(this TaskOrchestrationContext ctx, MyNS.MyClass input, TaskOptions? options = null) { return ctx.CallActivityAsync(""MyActivity"", input, options); @@ -250,6 +274,10 @@ abstract class MyActivityBase : TaskActivity string expectedOutput = TestHelpers.WrapAndFormat( GeneratedClassName, methodList: @" +/// +/// Calls the activity. +/// +/// public static Task CallMyActivityAsync(this TaskOrchestrationContext ctx, int input, TaskOptions? options = null) { return ctx.CallActivityAsync(""MyActivity"", input, options); @@ -440,6 +468,9 @@ class MyEntity : TaskEntity string expectedOutput = TestHelpers.WrapAndFormat( GeneratedClassName, methodList: @" +/// +/// Schedules a new instance of the orchestrator. +/// /// public static Task ScheduleNewMyOrchestratorInstanceAsync( this IOrchestrationSubmitter client, int input, StartOrchestrationOptions? options = null) @@ -447,6 +478,9 @@ public static Task ScheduleNewMyOrchestratorInstanceAsync( return client.ScheduleNewOrchestrationInstanceAsync(""MyOrchestrator"", input, options); } +/// +/// Calls the sub-orchestrator. +/// /// public static Task CallMyOrchestratorAsync( this TaskOrchestrationContext context, int input, TaskOptions? options = null) @@ -454,6 +488,10 @@ public static Task CallMyOrchestratorAsync( return context.CallSubOrchestratorAsync(""MyOrchestrator"", input, options); } +/// +/// Calls the activity. +/// +/// public static Task CallMyActivityAsync(this TaskOrchestrationContext ctx, int input, TaskOptions? options = null) { return ctx.CallActivityAsync(""MyActivity"", input, options);