| | | 1 | | using System.Diagnostics.CodeAnalysis; |
| | | 2 | | using Elsa.Workflows.Activities.Flowchart.Models; |
| | | 3 | | |
| | | 4 | | namespace Elsa.Workflows; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// Provides context information when an activity has completed. |
| | | 8 | | /// </summary> |
| | 10771 | 9 | | public record ActivityCompletedContext(ActivityExecutionContext TargetContext, ActivityExecutionContext ChildContext, ob |
| | | 10 | | { |
| | | 11 | | /// <summary> |
| | | 12 | | /// Gets the workflow execution context. |
| | | 13 | | /// </summary> |
| | 403 | 14 | | public WorkflowExecutionContext WorkflowExecutionContext => TargetContext.WorkflowExecutionContext; |
| | | 15 | | |
| | | 16 | | /// <summary> |
| | | 17 | | /// Resolves a required service using the service provider. |
| | | 18 | | /// </summary> |
| | | 19 | | /// <typeparam name="T">The service type.</typeparam> |
| | | 20 | | /// <returns>The resolved service.</returns> |
| | 0 | 21 | | public T GetRequiredService<T>() where T : notnull => WorkflowExecutionContext.GetRequiredService<T>(); |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// A cancellation token to use when invoking asynchronous operations. |
| | | 25 | | /// </summary> |
| | 0 | 26 | | public CancellationToken CancellationToken => WorkflowExecutionContext.CancellationToken; |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Complete the current activity. This should only be called by activities that explicitly suppress automatic-compl |
| | | 30 | | /// </summary> |
| | | 31 | | [RequiresUnreferencedCode("The activity may be serialized and executed in a different context.")] |
| | | 32 | | public async ValueTask CompleteActivityAsync(object? result = default) |
| | | 33 | | { |
| | 0 | 34 | | await TargetContext.CompleteActivityAsync(result); |
| | 0 | 35 | | } |
| | | 36 | | |
| | | 37 | | /// <summary> |
| | | 38 | | /// Complete the current activity with the specified outcomes. |
| | | 39 | | /// </summary> |
| | | 40 | | [RequiresUnreferencedCode("The activity may be serialized and executed in a different context.")] |
| | 0 | 41 | | public ValueTask CompleteActivityWithOutcomesAsync(params string[] outcomes) => CompleteActivityAsync(new Outcomes(o |
| | | 42 | | } |