From 6c7c62a8a289bf99b986ecd32ee2e606714056cb Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Fri, 28 Apr 2023 15:15:54 +0200 Subject: [PATCH] Ensure ResultVariable is declared in workflow memory space --- .../Elsa.Workflows.Core/Models/Workflow.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/modules/Elsa.Workflows.Core/Models/Workflow.cs b/src/modules/Elsa.Workflows.Core/Models/Workflow.cs index a3ef446b9..83dae2f01 100644 --- a/src/modules/Elsa.Workflows.Core/Models/Workflow.cs +++ b/src/modules/Elsa.Workflows.Core/Models/Workflow.cs @@ -51,6 +51,11 @@ public class Workflow : Composite, ICloneable { } + public WorkflowIdentity Identity { get; set; } = WorkflowIdentity.VersionOne; + public WorkflowPublication Publication { get; set; } = WorkflowPublication.LatestAndPublished; + public WorkflowMetadata WorkflowMetadata { get; set; } = new(); + public WorkflowOptions? Options { get; set; } + /// /// Constructs a new from the specified . /// @@ -66,10 +71,14 @@ public class Workflow : Composite, ICloneable return register; } - public WorkflowIdentity Identity { get; set; } = WorkflowIdentity.VersionOne; - public WorkflowPublication Publication { get; set; } = WorkflowPublication.LatestAndPublished; - public WorkflowMetadata WorkflowMetadata { get; set; } = new(); - public WorkflowOptions? Options { get; set; } + /// + protected override async ValueTask ExecuteAsync(ActivityExecutionContext context) + { + if(ResultVariable != null) + context.WorkflowExecutionContext.MemoryRegister.Declare(ResultVariable); + + await base.ExecuteAsync(context); + } /// /// Create a shallow copy of this workflow.