diff --git a/src/modules/Elsa.Workflows.Core/Abstractions/Activity.cs b/src/modules/Elsa.Workflows.Core/Abstractions/Activity.cs index bdb4cfbe1..c93d6cd32 100644 --- a/src/modules/Elsa.Workflows.Core/Abstractions/Activity.cs +++ b/src/modules/Elsa.Workflows.Core/Abstractions/Activity.cs @@ -59,8 +59,8 @@ public abstract class Activity : IActivity, ISignalHandler /// /// A flag indicating if this activity should execute synchronously or asynchronously. - /// By default, activities with an of , or - /// will execute synchronously, while activities of the kind will execute asynchronously. + /// By default, activities with an of , or + /// will execute synchronously, while activities of the kind will execute asynchronously. /// [JsonIgnore] public bool RunAsynchronously diff --git a/src/modules/Elsa.Workflows.Core/Activities/Workflow.cs b/src/modules/Elsa.Workflows.Core/Activities/Workflow.cs index ac57640f9..2396890af 100644 --- a/src/modules/Elsa.Workflows.Core/Activities/Workflow.cs +++ b/src/modules/Elsa.Workflows.Core/Activities/Workflow.cs @@ -38,6 +38,7 @@ public class Workflow : Composite, ICloneable Outputs = outputs; Outcomes = outcomes; WorkflowMetadata = workflowMetadata; + ToolVersion = new Version(1, 0); Options = options; Variables = variables; CustomProperties = customProperties; @@ -48,7 +49,7 @@ public class Workflow : Composite, ICloneable /// /// Constructor. /// - public Workflow(IActivity root) + public Workflow(IActivity root) : this() { Root = root; } @@ -58,6 +59,7 @@ public class Workflow : Composite, ICloneable /// public Workflow() { + ToolVersion = new Version(1, 0); } /// @@ -94,13 +96,16 @@ public class Workflow : Composite, ICloneable /// Gets or sets options for the workflow. /// public WorkflowOptions Options { get; set; } = new(); - - + /// /// Make workflow definition readonly. /// public bool IsReadonly { get; set; } + /// + /// The version of the tool that created this workflow. + /// + public Version ToolVersion { get; set; } /// /// Constructs a new from the specified . diff --git a/src/modules/Elsa.Workflows.Core/Contexts/ActivityExecutionContext.cs b/src/modules/Elsa.Workflows.Core/Contexts/ActivityExecutionContext.cs index ac007cc1f..389dab7eb 100644 --- a/src/modules/Elsa.Workflows.Core/Contexts/ActivityExecutionContext.cs +++ b/src/modules/Elsa.Workflows.Core/Contexts/ActivityExecutionContext.cs @@ -98,7 +98,8 @@ public class ActivityExecutionContext : IExecutionContext /// /// Returns the global node ID for the current activity within the graph. /// - public string NodeId => ActivityNode.NodeId; + /// As of tool version 3.0, all activity Ids are already unique, so there's no need to construct a hierarchical ID + public string NodeId => WorkflowExecutionContext.Workflow.ToolVersion >= new Version(3, 0) ? Activity.Id : ActivityNode.NodeId; /// /// A list of bookmarks created by the current activity.