elsa-core/samples/Sample01/Program.cs
Sipke Schoorstra 7ba8b1e8d6 Merge
2019-07-22 18:55:02 +02:00

33 lines
982 B
C#

using System;
using System.Threading.Tasks;
using Elsa.Extensions;
using Elsa.Persistence.Extensions;
using Elsa.Services;
using Microsoft.Extensions.DependencyInjection;
using Sample01.Activities;
namespace Sample01
{
/// <summary>
/// A minimal workflows program defined in code with a strongly-typed workflow class.
/// </summary>
class Program
{
static async Task Main(string[] args)
{
// Setup a service collection.
var services = new ServiceCollection()
.AddWorkflows()
.AddMemoryWorkflowInstanceStore()
.AddActivity<HelloWorld>()
.AddActivity<GoodByeWorld>()
.BuildServiceProvider();
// Invoke the workflow.
var invoker = services.GetService<IWorkflowInvoker>();
await invoker.InvokeAsync<HelloWorldWorkflow>();
Console.ReadLine();
}
}
}