| | | 1 | | using Elsa.Common.Models; |
| | | 2 | | using Elsa.Workflows.Runtime.Entities; |
| | | 3 | | |
| | | 4 | | namespace Elsa.Workflows.Runtime.Extensions; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// Provides extension methods for <see cref="ActivityExecutionRecord"/>. |
| | | 8 | | /// </summary> |
| | | 9 | | public static class ActivityExecutionRecordExtensions |
| | | 10 | | { |
| | | 11 | | /// <summary> |
| | | 12 | | /// Retrieves the execution chain for the specified activity execution record by using the store. |
| | | 13 | | /// Returns records ordered from root (depth 0) to the specified record. |
| | | 14 | | /// </summary> |
| | | 15 | | /// <param name="record">The activity execution record to retrieve the chain for.</param> |
| | | 16 | | /// <param name="store">The activity execution store to use for retrieving the chain.</param> |
| | | 17 | | /// <param name="includeCrossWorkflowChain">If true (default), follows SchedulingWorkflowInstanceId across workflow |
| | | 18 | | /// <param name="skip">The number of items to skip (for pagination).</param> |
| | | 19 | | /// <param name="take">The maximum number of items to return (for pagination).</param> |
| | | 20 | | /// <param name="cancellationToken">An optional cancellation token.</param> |
| | | 21 | | /// <returns>A paginated result containing the call stack records, ordered from root to leaf.</returns> |
| | | 22 | | public static Task<Page<ActivityExecutionRecord>> GetExecutionChainAsync( |
| | | 23 | | this ActivityExecutionRecord record, |
| | | 24 | | IActivityExecutionStore store, |
| | | 25 | | bool includeCrossWorkflowChain = true, |
| | | 26 | | int? skip = null, |
| | | 27 | | int? take = null, |
| | | 28 | | CancellationToken cancellationToken = default) |
| | | 29 | | { |
| | 0 | 30 | | return store.GetExecutionChainAsync(record.Id, includeCrossWorkflowChain, skip, take, cancellationToken); |
| | | 31 | | } |
| | | 32 | | } |