Update serializer and dependencies in ConsoleApp

The code now uses IWorkflowSerializer instead of IActivitySerializer for deserialization in the Console application. This change also entailed updating imports, specifically replacing Elsa.Workflows.Activities with Elsa.Workflows.Management.Contracts.
This commit is contained in:
Sipke Schoorstra 2024-02-24 19:38:53 +01:00
parent 937398e351
commit 640e888e1a

View file

@ -1,7 +1,7 @@
using Elsa.Extensions;
using Elsa.Testing.Shared;
using Elsa.Workflows.Activities;
using Elsa.Workflows.Contracts;
using Elsa.Workflows.Management.Contracts;
using Microsoft.Extensions.DependencyInjection;
// Setup service container.
@ -20,10 +20,10 @@ await serviceProvider.PopulateRegistriesAsync();
var workflowJson = await File.ReadAllTextAsync("HelloWorld.json");
// Get a serializer to deserialize the workflow.
var serializer = serviceProvider.GetRequiredService<IActivitySerializer>();
var serializer = serviceProvider.GetRequiredService<IWorkflowSerializer>();
// Deserialize the workflow.
var workflow = serializer.Deserialize<Workflow>(workflowJson);
var workflow = serializer.Deserialize(workflowJson);
// Resolve a workflow runner to run the workflow.
var workflowRunner = serviceProvider.GetRequiredService<IWorkflowRunner>();