| | | 1 | | using Elsa.Expressions.Models; |
| | | 2 | | using Elsa.Workflows.Models; |
| | | 3 | | |
| | | 4 | | namespace Elsa.Workflows; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// Base class for custom activities that return a result. |
| | | 8 | | /// </summary> |
| | | 9 | | public abstract class Activity<T> : Activity, IActivityWithResult<T> |
| | | 10 | | { |
| | | 11 | | /// <inheritdoc /> |
| | 717 | 12 | | protected Activity(string? source = default, int? line = default) : base(source, line) |
| | | 13 | | { |
| | 717 | 14 | | } |
| | | 15 | | |
| | | 16 | | /// <inheritdoc /> |
| | 0 | 17 | | protected Activity(string activityType, int version = 1, string? source = default, int? line = default) : base(activ |
| | | 18 | | { |
| | 0 | 19 | | } |
| | | 20 | | |
| | | 21 | | /// <inheritdoc /> |
| | 0 | 22 | | protected Activity(MemoryBlockReference? output, string? source = default, int? line = default) : this(source, line) |
| | | 23 | | { |
| | 0 | 24 | | if (output != null) Result = new Output<T>(output); |
| | 0 | 25 | | } |
| | | 26 | | |
| | | 27 | | /// <inheritdoc /> |
| | 0 | 28 | | protected Activity(Output<T>? output, string? source = default, int? line = default) : this(source, line) |
| | | 29 | | { |
| | 0 | 30 | | Result = output; |
| | 0 | 31 | | } |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// The result of the activity. |
| | | 35 | | /// </summary> |
| | 1686 | 36 | | public Output<T>? Result { get; set; } |
| | | 37 | | |
| | | 38 | | Output? IActivityWithResult.Result |
| | | 39 | | { |
| | 17 | 40 | | get => Result; |
| | 0 | 41 | | set => Result = (Output<T>?)value; |
| | | 42 | | } |
| | | 43 | | } |