diff --git a/src/modules/Elsa.Workflows.Runtime/Activities/BulkDispatchWorkflows.cs b/src/modules/Elsa.Workflows.Runtime/Activities/BulkDispatchWorkflows.cs
index 1340a3facf..eade3320c2 100644
--- a/src/modules/Elsa.Workflows.Runtime/Activities/BulkDispatchWorkflows.cs
+++ b/src/modules/Elsa.Workflows.Runtime/Activities/BulkDispatchWorkflows.cs
@@ -19,6 +19,7 @@
using Elsa.Workflows.Runtime.UIHints;
using Elsa.Workflows.Services;
using JetBrains.Annotations;
+using System.Diagnostics.CodeAnalysis;
namespace Elsa.Workflows.Runtime.Activities;
@@ -26,12 +27,12 @@ namespace Elsa.Workflows.Runtime.Activities;
/// Creates new workflow instances of the specified workflow for each item in the data source and dispatches them for execution.
///
[Activity("Elsa", "Composition", "Create new workflow instances for each item in the data source and dispatch them for execution.", Kind = ActivityKind.Task)]
-[FlowNode("Finished", "Canceled", "Done")]
+[FlowNode("Completed", "Canceled", "Done")]
[UsedImplicitly]
public class BulkDispatchWorkflows : Activity
{
private const string DispatchedInstancesCountKey = nameof(DispatchedInstancesCountKey);
- private const string FinishedInstancesCountKey = nameof(FinishedInstancesCountKey);
+ private const string CompletedInstancesCountKey = nameof(CompletedInstancesCountKey);
///
public BulkDispatchWorkflows([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
@@ -73,7 +74,7 @@ public BulkDispatchWorkflows([CallerFilePath] string? source = default, [CallerL
/// True to wait for the child workflow to complete before completing this activity, false to "fire and forget".
///
[Input(
- Description = "Wait for the dispatched workflows to complete before completing this activity. If set, the Finished outcome will not trigger.",
+ Description = "Wait for the dispatched workflows to complete before completing this activity.",
DefaultValue = true)]
public Input WaitForCompletion { get; set; } = new(true);
@@ -92,7 +93,7 @@ public BulkDispatchWorkflows([CallerFilePath] string? source = default, [CallerL
/// An activity to execute when the child workflow finishes.
///
[Port]
- public IActivity? ChildFinished { get; set; }
+ public IActivity? ChildCompleted { get; set; }
///
/// An activity to execute when the child workflow faults.
@@ -101,6 +102,7 @@ public BulkDispatchWorkflows([CallerFilePath] string? source = default, [CallerL
public IActivity? ChildFaulted { get; set; }
///
+ [RequiresUnreferencedCode("Calls Elsa.Expressions.Helpers.ObjectConverter.ConvertTo(ObjectConverterOptions)")]
protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
{
var waitForCompletion = WaitForCompletion.GetOrDefault(context);
@@ -203,15 +205,16 @@ private async ValueTask DispatchChildWorkflowAsync(ActivityExecutionCont
return instanceId;
}
+ [RequiresUnreferencedCode("Calls Elsa.Expressions.Helpers.ObjectConverter.ConvertTo(ObjectConverterOptions)")]
private async ValueTask OnChildWorkflowCompletedAsync(ActivityExecutionContext context)
{
var input = context.WorkflowInput;
var workflowInstanceId = input["WorkflowInstanceId"].ConvertTo()!;
var workflowSubStatus = input["WorkflowSubStatus"].ConvertTo();
var workflowOutput = input["WorkflowOutput"].ConvertTo>();
- var finishedInstancesCount = context.GetProperty(FinishedInstancesCountKey) + 1;
+ var finishedInstancesCount = context.GetProperty(CompletedInstancesCountKey) + 1;
- context.SetProperty(FinishedInstancesCountKey, finishedInstancesCount);
+ context.SetProperty(CompletedInstancesCountKey, finishedInstancesCount);
var childInstanceId = new Variable("ChildInstanceId", workflowInstanceId)
{
@@ -235,26 +238,26 @@ private async ValueTask OnChildWorkflowCompletedAsync(ActivityExecutionContext c
case WorkflowSubStatus.Faulted when ChildFaulted is not null:
await context.ScheduleActivityAsync(ChildFaulted, options);
return;
- case WorkflowSubStatus.Finished when ChildFinished is not null:
- await context.ScheduleActivityAsync(ChildFinished, options);
+ case WorkflowSubStatus.Finished when ChildCompleted is not null:
+ await context.ScheduleActivityAsync(ChildCompleted, options);
return;
default:
- await CheckIfFinishedAsync(context);
+ await CheckIfCompletedAsync(context);
break;
}
}
private async ValueTask OnChildFinishedCompletedAsync(ActivityCompletedContext context)
{
- await CheckIfFinishedAsync(context.TargetContext);
+ await CheckIfCompletedAsync(context.TargetContext);
}
- private async ValueTask CheckIfFinishedAsync(ActivityExecutionContext context)
+ private async ValueTask CheckIfCompletedAsync(ActivityExecutionContext context)
{
var dispatchedInstancesCount = context.GetProperty(DispatchedInstancesCountKey);
- var finishedInstancesCount = context.GetProperty(FinishedInstancesCountKey);
+ var finishedInstancesCount = context.GetProperty(CompletedInstancesCountKey);
if (finishedInstancesCount >= dispatchedInstancesCount)
- await context.CompleteActivityWithOutcomesAsync("Finished", "Done");
+ await context.CompleteActivityWithOutcomesAsync("Completed", "Done");
}
}
\ No newline at end of file