From 8099ac94ef0879bdb7fc50bf88f67ea5d15f3461 Mon Sep 17 00:00:00 2001 From: Radu Oancea Date: Wed, 20 Mar 2024 11:43:37 +0200 Subject: [PATCH] fix ParallelTracking namespace (#311) Co-authored-by: vuplea --- .../ParallelTrackingExtensionsTests.cs | 2 +- .../ParallelTrackingExtensions.cs | 50 +++++++++---------- .../Statements/Parallel.cs | 2 +- .../Statements/ParallelForEach.cs | 2 +- .../Statements/Pick.cs | 2 +- 5 files changed, 27 insertions(+), 31 deletions(-) diff --git a/src/Test/TestCases.Runtime/ParallelTrackingExtensionsTests.cs b/src/Test/TestCases.Runtime/ParallelTrackingExtensionsTests.cs index 1acc3141..8cc4bab9 100644 --- a/src/Test/TestCases.Runtime/ParallelTrackingExtensionsTests.cs +++ b/src/Test/TestCases.Runtime/ParallelTrackingExtensionsTests.cs @@ -2,9 +2,9 @@ using System; using System.Activities; using System.Activities.Statements; +using System.Activities.ParallelTracking; using System.Collections.Generic; using System.Linq; -using UiPath.Workflow.Runtime.ParallelTracking; using WorkflowApplicationTestExtensions; using Xunit; diff --git a/src/UiPath.Workflow.Runtime/ParallelTrackingExtensions.cs b/src/UiPath.Workflow.Runtime/ParallelTrackingExtensions.cs index 017f64c6..bd61376d 100644 --- a/src/UiPath.Workflow.Runtime/ParallelTrackingExtensions.cs +++ b/src/UiPath.Workflow.Runtime/ParallelTrackingExtensions.cs @@ -1,35 +1,31 @@ -using System; -using System.Activities; +namespace System.Activities.ParallelTracking; -namespace UiPath.Workflow.Runtime.ParallelTracking +/// +/// This feature introduces a context.GetCurrentParallelId() queryable from an activity, +/// which should identify a "parallelism" branch on which the activity executes. +/// Only containers which schedule concurrently (Parallel, ParallelForEach, Pick) +/// would induce a change of the background parallel id. +/// The initial parallel id, before using the above containers, is null. +/// +public static class ParallelTrackingExtensions { - /// - /// This feature introduces a context.GetCurrentParallelId() queryable from an activity, - /// which should identify a "parallelism" branch on which the activity executes. - /// Only containers which schedule concurrently (Parallel, ParallelForEach, Pick) - /// would induce a change of the background parallel id. - /// The initial parallel id, before using the above containers, is null. - /// - public static class ParallelTrackingExtensions - { - public const string BranchIdPropertyName = "__ParallelBranchId"; + public const string BranchIdPropertyName = "__ParallelBranchId"; - public static ActivityInstance MarkNewParallelBranch(this ActivityInstance instance) - { - var properties = new ExecutionProperties(null, instance, instance.PropertyManager); - var parentId = properties.Find(BranchIdPropertyName) as string; - properties.Add(BranchIdPropertyName, $"{parentId}.{Guid.NewGuid():N}".Trim('.'), true, false); + public static ActivityInstance MarkNewParallelBranch(this ActivityInstance instance) + { + var properties = new ExecutionProperties(null, instance, instance.PropertyManager); + var parentId = properties.Find(BranchIdPropertyName) as string; + properties.Add(BranchIdPropertyName, $"{parentId}.{Guid.NewGuid():N}".Trim('.'), true, false); - return instance; - } + return instance; + } - public static string GetCurrentParallelBranchId(this ActivityInstance instance) => - instance.PropertyManager?.GetPropertyAtCurrentScope(BranchIdPropertyName) as string; + public static string GetCurrentParallelBranchId(this ActivityInstance instance) => + instance.PropertyManager?.GetPropertyAtCurrentScope(BranchIdPropertyName) as string; - public static ActivityInstance MarkNewParallelBranch(this ActivityContext context) => - context.CurrentInstance?.MarkNewParallelBranch(); + public static ActivityInstance MarkNewParallelBranch(this ActivityContext context) => + context.CurrentInstance?.MarkNewParallelBranch(); - public static string GetCurrentParallelBranchId(this ActivityContext context) => - context.CurrentInstance?.GetCurrentParallelBranchId(); - } + public static string GetCurrentParallelBranchId(this ActivityContext context) => + context.CurrentInstance?.GetCurrentParallelBranchId(); } diff --git a/src/UiPath.Workflow.Runtime/Statements/Parallel.cs b/src/UiPath.Workflow.Runtime/Statements/Parallel.cs index c448d2d8..792e3fd8 100644 --- a/src/UiPath.Workflow.Runtime/Statements/Parallel.cs +++ b/src/UiPath.Workflow.Runtime/Statements/Parallel.cs @@ -2,9 +2,9 @@ // See LICENSE file in the project root for full license information. using System.Activities.Runtime.Collections; +using System.Activities.ParallelTracking; using System.Collections.ObjectModel; using System.Windows.Markup; -using UiPath.Workflow.Runtime.ParallelTracking; #if DYNAMICUPDATE using System.Activities.DynamicUpdate; diff --git a/src/UiPath.Workflow.Runtime/Statements/ParallelForEach.cs b/src/UiPath.Workflow.Runtime/Statements/ParallelForEach.cs index c00169f4..0d43473c 100644 --- a/src/UiPath.Workflow.Runtime/Statements/ParallelForEach.cs +++ b/src/UiPath.Workflow.Runtime/Statements/ParallelForEach.cs @@ -1,9 +1,9 @@ // This file is part of Core WF which is licensed under the MIT license. // See LICENSE file in the project root for full license information. +using System.Activities.ParallelTracking; using System.Collections.ObjectModel; using System.Windows.Markup; -using UiPath.Workflow.Runtime.ParallelTracking; #if DYNAMICUPDATE using System.Activities.DynamicUpdate; diff --git a/src/UiPath.Workflow.Runtime/Statements/Pick.cs b/src/UiPath.Workflow.Runtime/Statements/Pick.cs index f199cb8b..24ec0611 100644 --- a/src/UiPath.Workflow.Runtime/Statements/Pick.cs +++ b/src/UiPath.Workflow.Runtime/Statements/Pick.cs @@ -3,10 +3,10 @@ using System.Activities.Runtime; using System.Activities.Runtime.Collections; +using System.Activities.ParallelTracking; using System.Activities.Validation; using System.Collections.ObjectModel; using System.Windows.Markup; -using UiPath.Workflow.Runtime.ParallelTracking; namespace System.Activities.Statements;