| | | 1 | | using Elsa.Expressions.Helpers; |
| | | 2 | | using Elsa.Expressions.Models; |
| | | 3 | | using Elsa.Extensions; |
| | | 4 | | |
| | | 5 | | namespace Elsa.Expressions.CSharp.Models; |
| | | 6 | | |
| | | 7 | | /// <summary> |
| | | 8 | | /// Provides access to activity outputs. |
| | | 9 | | /// </summary> |
| | | 10 | | public class OutputProxy |
| | | 11 | | { |
| | | 12 | | private readonly ExpressionExecutionContext _expressionExecutionContext; |
| | | 13 | | |
| | | 14 | | /// <summary> |
| | | 15 | | /// Initializes a new instance of the <see cref="OutputProxy"/> class. |
| | | 16 | | /// </summary> |
| | 0 | 17 | | public OutputProxy(ExpressionExecutionContext expressionExecutionContext) |
| | | 18 | | { |
| | 0 | 19 | | _expressionExecutionContext = expressionExecutionContext; |
| | 0 | 20 | | } |
| | | 21 | | |
| | | 22 | | /// <summary> |
| | | 23 | | /// Gets the value of the specified output from the specified activity. |
| | | 24 | | /// </summary> |
| | | 25 | | /// <param name="activityIdOrName">The ID or name of the activity that produced the output.</param> |
| | | 26 | | /// <param name="outputName">The name of the output.</param> |
| | | 27 | | /// <returns>The value of the output.</returns> |
| | 0 | 28 | | public object? From(string activityIdOrName, string? outputName = null) => _expressionExecutionContext.GetOutput(act |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Gets the value of the specified output from the specified activity. |
| | | 32 | | /// </summary> |
| | | 33 | | /// <param name="activityIdOrName">The ID or name of the activity that produced the output.</param> |
| | | 34 | | /// <param name="outputName">The name of the output.</param> |
| | | 35 | | /// <returns>The value of the output.</returns> |
| | 0 | 36 | | public T? From<T>(string activityIdOrName, string? outputName = null) => From(activityIdOrName, outputName).ConvertT |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// Gets the value of the specified output. |
| | | 40 | | /// </summary> |
| | | 41 | | /// <param name="activityIdOrName">The ID or name of the activity that produced the output.</param> |
| | | 42 | | /// <param name="outputName">The name of the output.</param> |
| | | 43 | | /// <returns>The value of the output.</returns> |
| | | 44 | | [Obsolete("Use From instead.")] |
| | 0 | 45 | | public object? Get(string activityIdOrName, string? outputName = null) => From(activityIdOrName, outputName); |
| | | 46 | | |
| | | 47 | | /// <summary> |
| | | 48 | | /// Gets the value of the specified output. |
| | | 49 | | /// </summary> |
| | | 50 | | /// <param name="activityIdOrName">The ID or name of the activity that produced the output.</param> |
| | | 51 | | /// <param name="outputName">The name of the output.</param> |
| | | 52 | | /// <returns>The value of the output.</returns> |
| | | 53 | | [Obsolete("Use From instead.")] |
| | 0 | 54 | | public T? Get<T>(string activityIdOrName, string? outputName = null) => From<T>(activityIdOrName, outputName); |
| | | 55 | | |
| | | 56 | | /// <summary> |
| | | 57 | | /// Gets the result of the last activity that executed. |
| | | 58 | | /// </summary> |
| | 0 | 59 | | public object? LastResult => _expressionExecutionContext.GetLastResult(); |
| | | 60 | | } |