diff --git a/samples/AzureFunctionsApp/AzureFunctionsApp.csproj b/samples/AzureFunctionsApp/AzureFunctionsApp.csproj index 1c7000c8..0498bca1 100644 --- a/samples/AzureFunctionsApp/AzureFunctionsApp.csproj +++ b/samples/AzureFunctionsApp/AzureFunctionsApp.csproj @@ -1,4 +1,5 @@  + net6.0 v4 diff --git a/src/Abstractions/TaskActivity.cs b/src/Abstractions/TaskActivity.cs index e275a566..65e82e2f 100644 --- a/src/Abstractions/TaskActivity.cs +++ b/src/Abstractions/TaskActivity.cs @@ -51,7 +51,8 @@ public interface ITaskActivity /// Because activities only guarantee at least once execution, it's recommended that activity logic be implemented as /// idempotent whenever possible. /// -/// Activities are invoked by orchestrators using one of the +/// Activities are invoked by orchestrators using one of the +/// /// method overloads. Activities that derive from can also be invoked /// using generated extension methods. To participate in code generation, an activity class must be decorated with the /// attribute. The source generator will then generate a CallMyActivityAsync() diff --git a/src/Abstractions/TaskOrchestrationContext.cs b/src/Abstractions/TaskOrchestrationContext.cs index abd878e6..b3f139dc 100644 --- a/src/Abstractions/TaskOrchestrationContext.cs +++ b/src/Abstractions/TaskOrchestrationContext.cs @@ -108,15 +108,30 @@ public abstract class TaskOrchestrationContext /// property. /// public virtual Task CallActivityAsync(TaskName name, object? input = null, TaskOptions? options = null) - { - return this.CallActivityAsync(name, input, options); - } + => this.CallActivityAsync(name, input, options); + + /// + /// A task that completes when the activity completes or fails. The result of the task is the activity's return value. + /// + /// + public virtual Task CallActivityAsync(TaskName name, TaskOptions options) + => this.CallActivityAsync(name, null, options); /// /// A task that completes when the activity completes or fails. The result of the task is the activity's return value. /// - /// - public abstract Task CallActivityAsync(TaskName name, object? input = null, TaskOptions? options = null); + /// The type into which to deserialize the activity's output. + /// + public virtual Task CallActivityAsync(TaskName name, TaskOptions options) + => this.CallActivityAsync(name, null, options); + + /// + /// A task that completes when the activity completes or fails. The result of the task is the activity's return value. + /// + /// The type into which to deserialize the activity's output. + /// + public abstract Task CallActivityAsync( + TaskName name, object? input = null, TaskOptions? options = null); /// /// Creates a durable timer that expires after the specified delay. @@ -247,13 +262,26 @@ public async Task WaitForExternalEvent(string eventName, TimeSpan timeout) /// /// Executes a named sub-orchestrator and returns the result. /// - /// - /// The type into which to deserialize the sub-orchestrator's output. - /// + /// The type into which to deserialize the sub-orchestrator's output. /// public abstract Task CallSubOrchestratorAsync( TaskName orchestratorName, object? input = null, TaskOptions? options = null); + /// + /// Executes a named sub-orchestrator and returns the result. + /// + /// The type into which to deserialize the sub-orchestrator's output. + /// + public virtual Task CallSubOrchestratorAsync(TaskName orchestratorName, TaskOptions options) + => this.CallSubOrchestratorAsync(orchestratorName, null, options); + + /// + /// Executes a named sub-orchestrator and returns the result. + /// + /// + public virtual Task CallSubOrchestratorAsync(TaskName orchestratorName, TaskOptions options) + => this.CallSubOrchestratorAsync(orchestratorName, null, options); + /// /// Executes a named sub-orchestrator. /// @@ -296,11 +324,9 @@ public abstract Task CallSubOrchestratorAsync( /// The sub-orchestration failed with an unhandled exception. The details of the failure can be found in the /// property. /// - public Task CallSubOrchestratorAsync( + public virtual Task CallSubOrchestratorAsync( TaskName orchestratorName, object? input = null, TaskOptions? options = null) - { - return this.CallSubOrchestratorAsync(orchestratorName, input, options); - } + => this.CallSubOrchestratorAsync(orchestratorName, input, options); /// /// Restarts the orchestration with a new input and clears its history. diff --git a/src/Abstractions/TaskOrchestrator.cs b/src/Abstractions/TaskOrchestrator.cs index 326bca7c..07dca1e5 100644 --- a/src/Abstractions/TaskOrchestrator.cs +++ b/src/Abstractions/TaskOrchestrator.cs @@ -45,7 +45,8 @@ public interface ITaskOrchestrator /// /// /// Orchestrators can be scheduled using an external client (see Microsoft.DurableTask.Client). Orchestrators can -/// also invoke child orchestrators using the method. +/// also invoke child orchestrators using the +/// method. /// Orchestrators that derive from can also be invoked using /// generated extension methods. To participate in code generation, an orchestrator class must be decorated with the /// attribute. The source generator will then generate a diff --git a/src/Client/Core/DurableTaskClient.cs b/src/Client/Core/DurableTaskClient.cs index 0902485f..9cf3e822 100644 --- a/src/Client/Core/DurableTaskClient.cs +++ b/src/Client/Core/DurableTaskClient.cs @@ -50,6 +50,11 @@ public virtual Task ScheduleNewOrchestrationInstanceAsync( TaskName orchestratorName, object? input, CancellationToken cancellation) => this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, input, null, cancellation); + /// + public virtual Task ScheduleNewOrchestrationInstanceAsync( + TaskName orchestratorName, StartOrchestrationOptions options, CancellationToken cancellation = default) + => this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, null, options, cancellation); + /// /// Schedules a new orchestration instance for execution. ///