elsa-core/src/samples/console/Elsa.Samples.SwitchConsole/Program.cs
Sipke Schoorstra 993e08ea89
Refactored Switch Activity (#545)
* Add IfThen activity + sample

* Add match mode

* Rename IfThen to Switch
2020-12-29 16:40:21 +01:00

32 lines
1.1 KiB
C#

using System.Threading.Tasks;
using Elsa.Services;
using Microsoft.Extensions.DependencyInjection;
namespace Elsa.Samples.SwitchConsole
{
/// <summary>
/// Demonstrates a workflow with a While looping construct.
/// </summary>
static class Program
{
private static async Task Main()
{
// Create a service container with Elsa services.
var services = new ServiceCollection()
.AddElsa(options => options
.AddConsoleActivities()
.AddWorkflow<GrayscaleWorkflow>())
.BuildServiceProvider();
// Run startup actions (not needed when registering Elsa with a Host).
var startupRunner = services.GetRequiredService<IStartupRunner>();
await startupRunner.StartupAsync();
// Get a workflow runner.
var workflowRunner = services.GetRequiredService<IWorkflowRunner>();
// Execute the workflow.
await workflowRunner.RunWorkflowAsync<GrayscaleWorkflow>();
}
}
}