Add ResultType to InsertResultCommand in all handlers

Added the Type property (ResultType) to every InsertResultCommand sent in PostprocessingBehavior, PreprocessingBehavior, and InvokeRecActionViewCommand. This ensures each result now includes its context (Post, Pre, or Main), both in normal and exception flows.
This commit is contained in:
2026-03-25 11:17:38 +01:00
parent d7783b6e81
commit aef59def7f
3 changed files with 12 additions and 6 deletions

View File

@@ -149,7 +149,8 @@ public class InvokeRecActionViewCommandHandler(
StatusId = statusCode,
ActionId = action.Id,
Header = JsonSerializer.Serialize(resHeaders, options: new() { WriteIndented = false }),
Body = resBody
Body = resBody,
Type = ResultType.Main
}, cancel);
}
catch(Exception ex)
@@ -157,7 +158,8 @@ public class InvokeRecActionViewCommandHandler(
await sender.Send(new InsertResultCommand()
{
ActionId = action.Id,
Error = ex.ToString()
Error = ex.ToString(),
Type = ResultType.Main
}, cancel);
if (action.ErrorAction == ErrorAction.Stop)