| | | 1 | | namespace AsyncResponse; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// A statically-typed durable-flow registration produced by |
| | | 5 | | /// <c>WithDurableFlow<TFlow, TInput>()</c>. The executor prefers it over the reflection path |
| | | 6 | | /// when re-hydrating a run from its persisted <see cref="FlowState.FlowTypeName"/>: the flow |
| | | 7 | | /// resolves, its input deserializes through typed JSON metadata, and <c>ExecuteAsync</c> is a |
| | | 8 | | /// direct delegate call — no type-name scans, no <c>MakeGenericType</c>, no |
| | | 9 | | /// <c>MethodInfo.Invoke</c> — which is what lets registered flows run under trimming/Native AOT. |
| | | 10 | | /// Unregistered flows keep the historical reflection-based resolution. |
| | | 11 | | /// </summary> |
| | | 12 | | internal sealed class DurableFlowRegistration |
| | | 13 | | { |
| | | 14 | | /// <summary>The flow class full name as persisted in <see cref="FlowState.FlowTypeName"/>.</summary> |
| | 3775 | 15 | | public required string FlowTypeFullName { get; init; } |
| | | 16 | | |
| | | 17 | | /// <summary> |
| | | 18 | | /// The TInput full name, formatted exactly as <see cref="FlowState.InputTypeName"/> is stamped |
| | | 19 | | /// at start (<c>typeof(TInput).FullName</c>), so the executor can reject a persisted run whose |
| | | 20 | | /// input type no longer matches this registration instead of silently deserializing it. |
| | | 21 | | /// </summary> |
| | 4047 | 22 | | public required string InputTypeFullName { get; init; } |
| | | 23 | | |
| | | 24 | | /// <summary>The flow class, resolved from DI per execution.</summary> |
| | 4045 | 25 | | public required Type FlowType { get; init; } |
| | | 26 | | |
| | | 27 | | /// <summary>Deserializes the persisted input JSON as the flow's TInput.</summary> |
| | 4045 | 28 | | public required Func<string, object?> DeserializeInput { get; init; } |
| | | 29 | | |
| | | 30 | | /// <summary>Invokes <c>((TFlow)flow).ExecuteAsync(context, (TInput)input)</c> statically.</summary> |
| | 4047 | 31 | | public required Func<object, IDurableFlowContext, object?, Task> ExecuteAsync { get; init; } |
| | | 32 | | } |