Add support for Complete activity serialization using default ctor

This commit is contained in:
Sipke Schoorstra 2022-12-01 22:25:41 +01:00
parent 6fbea8cdea
commit 2ce5b34b70

View file

@ -1,4 +1,5 @@
using System.ComponentModel;
using System.Text.Json.Serialization;
using Elsa.Expressions.Models;
using Elsa.Workflows.Core.Activities.Flowchart.Models;
using Elsa.Workflows.Core.Attributes;
@ -13,6 +14,12 @@ namespace Elsa.Workflows.Core.Activities;
[Activity("Elsa", "Primitives", "Signals the current composite activity to complete itself as a whole.")]
public class Complete : Activity
{
/// <inheritdoc />
[JsonConstructor]
public Complete()
{
}
/// <inheritdoc />
public Complete(params string[] outcomes) : this(new Input<ICollection<string>>(outcomes))
{
@ -35,7 +42,7 @@ public class Complete : Activity
/// The outcome or set of outcomes to complete this activity with.
/// </summary>
[Description("The outcome or set of outcomes to complete this activity with.")]
public Input<ICollection<string>> Outcomes { get; set; }
public Input<ICollection<string>> Outcomes { get; set; } = new(new List<string>());
/// <inheritdoc />
protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)