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