29 lines
697 B
C#
29 lines
697 B
C#
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();
|
|
|
|
// Create a workflow.
|
|
var workflow = new Sequence
|
|
{
|
|
Activities =
|
|
{
|
|
new WriteLine("Hello World!"),
|
|
new WriteLine("Goodbye cruel world...")
|
|
}
|
|
};
|
|
|
|
// Resolve a workflow runner to run the workflow.
|
|
var workflowRunner = serviceProvider.GetRequiredService<IWorkflowRunner>();
|
|
|
|
// Run the workflow.
|
|
await workflowRunner.RunAsync(workflow); |