* Seperate YesSql and added InMemory, MongoDb * Error fixed, if DatabaseInitializer is run through several times * icon.png was not packed * Added AddWorkflowProvider to AddElsaPersistenceMongoDb * Wrong primary keys were used for MongoDb * Refactorig MongoDb * Register IMongoCollection<WorkflowDefinition> and IMongoCollection<WorkflowInstance> with DI * Wrong Parameter Type in Constructor (MongoDbWorkflowInstanceRepository) * Add workflowDefinition.WorkflowDefinitionId = _idGenerator.Generate(); to Initialize * Removed duplicated code * Correct wrong Commit Co-authored-by: Rafael Carnucci <rafael.carnucci@icn.de> Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using System.Threading.Tasks;
|
|
|
|
using Elsa.Persistence.InMemory;
|
|
using Elsa.Services;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace Elsa.Samples.WhileLoopConsole
|
|
{
|
|
/// <summary>
|
|
/// Demonstrates a workflow with a While looping construct.
|
|
/// </summary>
|
|
static class Program
|
|
{
|
|
private static async Task Main()
|
|
{
|
|
// Create a service container with Elsa services.
|
|
var services = new ServiceCollection()
|
|
.AddElsa()
|
|
.AddElsaPersistenceInMemory()
|
|
.AddConsoleActivities()
|
|
.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>();
|
|
|
|
// Execute the workflow.
|
|
await workflowRunner.RunWorkflowAsync(new WhileLoopWorkflow(3));
|
|
}
|
|
}
|
|
} |