33 lines
982 B
C#
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();
|
|
}
|
|
}
|
|
} |