diff --git a/src/clients/Elsa.Api.Client/Resources/ActivityDescriptors/Models/ActivityDescriptor.cs b/src/clients/Elsa.Api.Client/Resources/ActivityDescriptors/Models/ActivityDescriptor.cs index adcb69983..f43558eb9 100644 --- a/src/clients/Elsa.Api.Client/Resources/ActivityDescriptors/Models/ActivityDescriptor.cs +++ b/src/clients/Elsa.Api.Client/Resources/ActivityDescriptors/Models/ActivityDescriptor.cs @@ -43,12 +43,12 @@ public record ActivityDescriptor /// /// The input properties of the activity type. /// - public ICollection Inputs { get; init; } = new List(); + public IReadOnlyCollection Inputs { get; init; } = new List(); /// /// The output properties of the activity type. /// - public ICollection Outputs { get; init; } = new List(); + public IReadOnlyCollection Outputs { get; init; } = new List(); /// /// The kind of activity. @@ -58,12 +58,12 @@ public record ActivityDescriptor /// /// The ports of the activity type. /// - public ICollection Ports { get; init; } = new List(); + public IReadOnlyCollection Ports { get; init; } = new List(); /// /// The custom properties of the activity type. /// - public IDictionary CustomProperties { get; set; } = new Dictionary(); + public IReadOnlyDictionary CustomProperties { get; set; } = new Dictionary(); /// /// A value indicating whether this activity is a container of child activities. diff --git a/src/modules/Elsa.Workflows.Core/Activities/Switch.cs b/src/modules/Elsa.Workflows.Core/Activities/Switch.cs index f776f814f..56d9c9048 100644 --- a/src/modules/Elsa.Workflows.Core/Activities/Switch.cs +++ b/src/modules/Elsa.Workflows.Core/Activities/Switch.cs @@ -30,12 +30,6 @@ public class Switch : Activity { } - /// - /// The value to switch on. - /// - [Input(Description = "The value to switch on.")] - public Input Expression { get; set; } = default!; - /// /// The value to switch on, made available as output for capturing. /// @@ -64,10 +58,8 @@ public class Switch : Activity /// protected override async ValueTask ExecuteAsync(ActivityExecutionContext context) { - context.Set(Output, Expression); - var matchingCases = await FindMatchingCasesAsync(context.ExpressionExecutionContext); + var matchingCases = (await FindMatchingCasesAsync(context.ExpressionExecutionContext)).ToList(); var hasAnyMatches = matchingCases.Any(); - var mode = context.Get(Mode); var results = mode == SwitchMode.MatchFirst ? hasAnyMatches ? new[] { matchingCases.First() } : Array.Empty() : matchingCases.ToArray();