| | | 1 | | using System.Runtime.CompilerServices; |
| | | 2 | | using Elsa.Extensions; |
| | | 3 | | using Elsa.Workflows.Attributes; |
| | | 4 | | using Elsa.Workflows.Models; |
| | | 5 | | using JetBrains.Annotations; |
| | | 6 | | |
| | | 7 | | namespace Elsa.Workflows.Activities; |
| | | 8 | | |
| | | 9 | | /// <summary> |
| | | 10 | | /// Sets a property on the workflow execution context with the specified name value. |
| | | 11 | | /// </summary> |
| | | 12 | | [Activity("Elsa", "Primitives", "Set the name of the workflow instance to a specified value.")] |
| | | 13 | | [PublicAPI] |
| | | 14 | | public class SetName : CodeActivity |
| | | 15 | | { |
| | | 16 | | /// <inheritdoc /> |
| | 24 | 17 | | public SetName([CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(source, line) |
| | | 18 | | { |
| | 24 | 19 | | } |
| | | 20 | | |
| | | 21 | | /// <inheritdoc /> |
| | 1 | 22 | | public SetName(Input<string> value, [CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : t |
| | | 23 | | { |
| | 1 | 24 | | Value = value; |
| | 1 | 25 | | } |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// The value to set the workflow instance's name to. |
| | | 29 | | /// </summary> |
| | 102 | 30 | | public Input<string> Value { get; set; } = new(""); |
| | | 31 | | |
| | | 32 | | /// <inheritdoc /> |
| | | 33 | | protected override void Execute(ActivityExecutionContext context) |
| | | 34 | | { |
| | 11 | 35 | | var value = Value.GetOrDefault(context); |
| | 11 | 36 | | context.WorkflowExecutionContext.Name = value; |
| | 11 | 37 | | } |
| | | 38 | | } |