pass inputs to RunWorkflowInstanceRequest in RunWorkflowUntilEndAsync (#7022)

This commit is contained in:
FuJa0815 2025-11-11 17:41:47 +01:00 committed by GitHub
parent 54af5ea714
commit 7214a0f6ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -26,11 +26,13 @@ public static class RunWorkflowExtensions
/// <param name="services">The services.</param>
/// <param name="workflowDefinitionId">The ID of the workflow definition.</param>
/// <param name="input">An optional dictionary of input values.</param>
/// <param name="correlationId">An optional correlation id of the workflow.</param>
/// <param name="versionOptions">An optional set of options to specify the version of the workflow definition to retrieve.</param>
/// <returns>The workflow state.</returns>
public static async Task<WorkflowState> RunWorkflowUntilEndAsync(this IServiceProvider services,
string workflowDefinitionId,
IDictionary<string, object>? input = null,
string? correlationId = null,
VersionOptions? versionOptions = null)
{
var workflowDefinitionService = services.GetRequiredService<IWorkflowDefinitionService>();
@ -44,7 +46,8 @@ public static class RunWorkflowExtensions
var response = await workflowClient.CreateAndRunInstanceAsync(new()
{
WorkflowDefinitionHandle = WorkflowDefinitionHandle.ByDefinitionVersionId(workflowGraph.Workflow.Identity.Id),
Input = input
Input = input,
CorrelationId = correlationId
});
var bookmarkStore = services.GetRequiredService<IBookmarkStore>();
@ -64,7 +67,8 @@ public static class RunWorkflowExtensions
{
var runRequest = new RunWorkflowInstanceRequest
{
BookmarkId = bookmark.Id
BookmarkId = bookmark.Id,
Input = input
};
response = await workflowClient.RunInstanceAsync(runRequest);
}