2023-01-23 14:59:06 +00:00
|
|
|
|
using Elsa.Extensions;
|
2023-06-08 10:01:26 +00:00
|
|
|
|
using Elsa.Samples.ConsoleApp.OutboundHttpRequests.Workflows;
|
2023-03-03 21:47:23 +00:00
|
|
|
|
using Elsa.Workflows.Core.Contracts;
|
2023-09-09 20:35:41 +00:00
|
|
|
|
using Microsoft.Extensions.Configuration;
|
2023-01-23 14:59:06 +00:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
|
|
// Setup service container.
|
|
|
|
|
|
var services = new ServiceCollection();
|
|
|
|
|
|
|
2023-09-09 20:35:41 +00:00
|
|
|
|
// Manually construct configuration. Normally this is provided by the host builder, but this is a simple Console app.
|
|
|
|
|
|
var config = new ConfigurationBuilder().Build();
|
|
|
|
|
|
services.AddSingleton<IConfiguration>(config);
|
|
|
|
|
|
|
2023-01-23 14:59:06 +00:00
|
|
|
|
// Add Elsa services.
|
|
|
|
|
|
services.AddElsa(elsa => elsa.UseHttp());
|
|
|
|
|
|
|
|
|
|
|
|
// Build service container.
|
|
|
|
|
|
var serviceProvider = services.BuildServiceProvider();
|
|
|
|
|
|
|
|
|
|
|
|
// Resolve a workflow runner to run the workflow.
|
|
|
|
|
|
var workflowRunner = serviceProvider.GetRequiredService<IWorkflowRunner>();
|
|
|
|
|
|
|
|
|
|
|
|
// Run the workflow.
|
|
|
|
|
|
await workflowRunner.RunAsync<GetUsersWorkflow>();
|