| | | 1 | | using Elsa.Expressions.Models; |
| | | 2 | | using Elsa.Extensions; |
| | | 3 | | using JetBrains.Annotations; |
| | | 4 | | |
| | | 5 | | namespace Elsa.Expressions.CSharp.Models; |
| | | 6 | | |
| | | 7 | | /// <summary> |
| | | 8 | | /// Provides access to global objects, such as the workflow execution context. |
| | | 9 | | /// </summary> |
| | | 10 | | [UsedImplicitly] |
| | | 11 | | public partial class Globals |
| | | 12 | | { |
| | | 13 | | /// <summary> |
| | | 14 | | /// Initializes a new instance of the <see cref="Globals"/> class. |
| | | 15 | | /// </summary> |
| | 0 | 16 | | public Globals(ExpressionExecutionContext expressionExecutionContext, IDictionary<string, object> arguments) |
| | | 17 | | { |
| | 0 | 18 | | ExpressionExecutionContext = expressionExecutionContext; |
| | 0 | 19 | | Arguments = arguments; |
| | 0 | 20 | | ExecutionContext = new(expressionExecutionContext); |
| | 0 | 21 | | Output = new(expressionExecutionContext); |
| | 0 | 22 | | Outcome = new(expressionExecutionContext); |
| | 0 | 23 | | } |
| | | 24 | | |
| | | 25 | | /// <summary> |
| | | 26 | | /// Provides access to activity outcomes. |
| | | 27 | | /// </summary> |
| | 0 | 28 | | public OutcomeProxy Outcome { get; set; } |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Provides access to activity outputs. |
| | | 32 | | /// </summary> |
| | 0 | 33 | | public OutputProxy Output { get; set; } |
| | | 34 | | |
| | | 35 | | /// <summary> |
| | | 36 | | /// Gets the current execution context. |
| | | 37 | | /// </summary> |
| | 0 | 38 | | public ExecutionContextProxy ExecutionContext { get; } |
| | | 39 | | |
| | | 40 | | /// <summary> |
| | | 41 | | /// Gets the ID of the current workflow instance. |
| | | 42 | | /// </summary> |
| | 0 | 43 | | public string WorkflowInstanceId => ExpressionExecutionContext.GetWorkflowExecutionContext().Id; |
| | | 44 | | |
| | | 45 | | /// <summary> |
| | | 46 | | /// Gets or sets the correlation ID of the current workflow instance. |
| | | 47 | | /// </summary> |
| | | 48 | | public string? CorrelationId |
| | | 49 | | { |
| | 0 | 50 | | get => ExpressionExecutionContext.GetWorkflowExecutionContext().CorrelationId; |
| | 0 | 51 | | set => ExpressionExecutionContext.GetWorkflowExecutionContext().CorrelationId = value; |
| | | 52 | | } |
| | | 53 | | |
| | | 54 | | /// <summary> |
| | | 55 | | /// Gets or sets the name of the current workflow instance. |
| | | 56 | | /// </summary> |
| | | 57 | | public string? WorkflowInstanceName |
| | | 58 | | { |
| | 0 | 59 | | get => ExpressionExecutionContext.GetWorkflowExecutionContext().Name; |
| | 0 | 60 | | set => ExpressionExecutionContext.GetWorkflowExecutionContext().Name = value; |
| | | 61 | | } |
| | | 62 | | |
| | | 63 | | /// <summary> |
| | | 64 | | /// Gets additional arguments provided by the caller of the evaluator. |
| | | 65 | | /// </summary> |
| | 0 | 66 | | public IDictionary<string, object> Arguments { get; } |
| | | 67 | | |
| | 0 | 68 | | private ExpressionExecutionContext ExpressionExecutionContext { get; } |
| | | 69 | | } |