using System; using System.Threading.Tasks; using Elsa.Activities.Console.Extensions; using Elsa.Extensions; using Elsa.Persistence.Memory; using Elsa.Scripting; using Elsa.Services; using Microsoft.Extensions.DependencyInjection; namespace Sample13 { /// /// A strongly-typed workflows program demonstrating scripting, and branching. /// class Program { static async Task Main() { // Setup a service collection. var services = new ServiceCollection() .AddWorkflows() .AddMemoryWorkflowInstanceStore() .AddConsoleActivities() .AddSingleton() .BuildServiceProvider(); // Create a workflow. var workflowFactory = services.GetRequiredService(); var workflow = workflowFactory.CreateWorkflow(); // Invoke the workflow. var invoker = services.GetService(); await invoker.InvokeAsync(workflow); Console.ReadLine(); } } }