| | | 1 | | using Elsa.Workflows.Runtime; |
| | | 2 | | using Elsa.Workflows.Runtime.Entities; |
| | | 3 | | |
| | | 4 | | // ReSharper disable once CheckNamespace |
| | | 5 | | namespace Elsa.Extensions; |
| | | 6 | | |
| | | 7 | | /// <summary> |
| | | 8 | | /// Canonical default order for <see cref="IWorkflowExecutionLogStore"/> queries that omit an explicit order. |
| | | 9 | | /// </summary> |
| | | 10 | | public static class WorkflowExecutionLogRecordQueryableExtensions |
| | | 11 | | { |
| | | 12 | | /// <summary> |
| | | 13 | | /// Timestamp ascending, then Sequence ascending, then Id ascending. |
| | | 14 | | /// </summary> |
| | | 15 | | /// <remarks> |
| | | 16 | | /// Preserves EF's historical Timestamp default and uses Sequence as the same-timestamp |
| | | 17 | | /// tiebreaker — the purpose of <see cref="WorkflowExecutionLogRecord.Sequence"/>. |
| | | 18 | | /// Sequence is per execution context, so distinct instances can share Timestamp+Sequence; |
| | | 19 | | /// Id is the unique key that keeps offset pagination stable across Memory and EF. |
| | | 20 | | /// Journal list APIs still pass Sequence-primary order explicitly because Sequence is |
| | | 21 | | /// the instance-monotonic event cursor (<c>ExecutionLogSequence</c>). |
| | | 22 | | /// </remarks> |
| | | 23 | | public static IQueryable<WorkflowExecutionLogRecord> OrderByTimestampThenSequence(this IQueryable<WorkflowExecutionL |
| | 45 | 24 | | queryable.OrderBy(x => x.Timestamp).ThenBy(x => x.Sequence).ThenBy(x => x.Id); |
| | | 25 | | } |