| | | 1 | | using Elsa.Expressions.Helpers; |
| | | 2 | | using Elsa.Expressions.Models; |
| | | 3 | | using Elsa.Extensions; |
| | | 4 | | using JetBrains.Annotations; |
| | | 5 | | |
| | | 6 | | namespace Elsa.Expressions.CSharp.Models; |
| | | 7 | | |
| | | 8 | | /// <summary> |
| | | 9 | | /// Provides access to the current execution context. |
| | | 10 | | /// </summary> |
| | | 11 | | [UsedImplicitly] |
| | | 12 | | public partial class ExecutionContextProxy |
| | | 13 | | { |
| | | 14 | | /// <summary> |
| | | 15 | | /// Gets the current execution context. |
| | | 16 | | /// </summary> |
| | 0 | 17 | | public ExpressionExecutionContext ExpressionExecutionContext { get; } |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// Initializes a new instance of the <see cref="ExecutionContextProxy"/> class. |
| | | 21 | | /// </summary> |
| | 0 | 22 | | public ExecutionContextProxy(ExpressionExecutionContext expressionExecutionContext) |
| | | 23 | | { |
| | 0 | 24 | | ExpressionExecutionContext = expressionExecutionContext; |
| | 0 | 25 | | } |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// Gets the value of the specified variable. |
| | | 29 | | /// </summary> |
| | 0 | 30 | | public T? GetVariable<T>(string name) => ExpressionExecutionContext.GetVariableInScope(name).ConvertTo<T>(); |
| | | 31 | | |
| | | 32 | | /// <summary> |
| | | 33 | | /// Gets the value of the specified variable. |
| | | 34 | | /// </summary> |
| | 0 | 35 | | public object? GetVariable(string name) => ExpressionExecutionContext.GetVariableInScope(name); |
| | | 36 | | |
| | | 37 | | /// <summary> |
| | | 38 | | /// Sets the value of the specified variable. |
| | | 39 | | /// </summary> |
| | 0 | 40 | | public void SetVariable(string name, object? value) => ExpressionExecutionContext.SetVariable(name, value); |
| | | 41 | | |
| | | 42 | | /// <summary> |
| | | 43 | | /// Gets the value of the specified variable. |
| | | 44 | | /// </summary> |
| | 0 | 45 | | public T? GetInput<T>(string name) => ExpressionExecutionContext.GetInput<T>(name); |
| | | 46 | | } |