using Elsa.Extensions; using Elsa.Workflows.Activities; using Elsa.Workflows.Contracts; using Microsoft.Extensions.DependencyInjection; // Setup service container. var services = new ServiceCollection(); // Add Elsa services. services.AddElsa(); // Build service container. var serviceProvider = services.BuildServiceProvider(); // Define a simple workflow, which in this case is a very simple activity that writes something to the console: var workflow = new WriteLine("Hello world!"); // Resolve a workflow runner to run the workflow. var workflowRunner = serviceProvider.GetRequiredService(); // Run the workflow. await workflowRunner.RunAsync(workflow);