elsa-core/src/samples/console/Elsa.Samples.AutoConnectNextActivityConsole/Program.cs
Sipke Schoorstra 3814ea6ff4
Update OutcomeResult to try a default connection via implicit "Done" outcome (#655)
* Update OutcomeResult to try a default connection via implicit "Done" outcome

* Add demo project for auto-connected activities
2021-02-24 14:29:56 +01:00

32 lines
1.1 KiB
C#

using System.Threading.Tasks;
using Elsa.Samples.AutoConnectNextActivityConsole.Activities;
using Elsa.Samples.AutoConnectNextActivityConsole.Workflows;
using Elsa.Services;
using Microsoft.Extensions.DependencyInjection;
namespace Elsa.Samples.AutoConnectNextActivityConsole
{
class Program
{
private static async Task Main()
{
// Create a service container with Elsa services.
var services = new ServiceCollection()
.AddElsa(options => options
.AddConsoleActivities()
.AddActivity<SomeCustomActivity>()
.AddWorkflow<Demoworkflow>())
.BuildServiceProvider();
// Run startup actions (not needed when registering Elsa with a Host).
var startupRunner = services.GetRequiredService<IStartupRunner>();
await startupRunner.StartupAsync();
// Get a workflow runner.
var workflowRunner = services.GetRequiredService<IWorkflowRunner>();
// Run the workflow.
await workflowRunner.RunWorkflowAsync<Demoworkflow>();
}
}
}