forked from elsa-workflows/elsa-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ForEachWorkflow.cs
35 lines (30 loc) · 922 Bytes
/
ForEachWorkflow.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System.Collections.Generic;
using Elsa.Workflows.Core.Activities;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core.Services;
namespace Elsa.IntegrationTests.Activities;
class ForEachWorkflow : WorkflowBase
{
private readonly ICollection<string> _items;
public ForEachWorkflow(ICollection<string> items)
{
_items = items;
}
protected override void Build(IWorkflowBuilder workflow)
{
var currentItem = new Variable<string>("CurrentItem");
workflow.Root = new Sequence
{
Variables = { currentItem },
Activities =
{
new ForEach<string>
{
Items = new Input<ICollection<string>>(_items),
CurrentValue = new Output<string?>(currentItem),
Body = new WriteLine(currentItem)
},
}
};
}
}