From 0a3761921d470e62be28a8f8783ea2338cbd83f6 Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 2 Mar 2026 13:11:50 +0100 Subject: [PATCH] Refactor RecActionView command invocation, remove extension Removed the ToInvokeCommand extension method and now construct InvokeRecActionViewCommand instances directly in the batch handler. Also added an unused using directive in InvokeBatchRecActionViewsCommand.cs. --- .../RecActions/Commands/InvokeBatchRecActionViewsCommand.cs | 5 +++-- .../RecActions/Commands/InvokeRecActionViewCommand.cs | 5 ----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/ReC.Application/RecActions/Commands/InvokeBatchRecActionViewsCommand.cs b/src/ReC.Application/RecActions/Commands/InvokeBatchRecActionViewsCommand.cs index 5fea716..e8f1f48 100644 --- a/src/ReC.Application/RecActions/Commands/InvokeBatchRecActionViewsCommand.cs +++ b/src/ReC.Application/RecActions/Commands/InvokeBatchRecActionViewsCommand.cs @@ -1,4 +1,5 @@ -using MediatR; +using DigitalData.Core.Abstractions.Interfaces; +using MediatR; using ReC.Application.RecActions.Queries; using ReC.Domain.Constants; @@ -23,7 +24,7 @@ public class InvokeRecActionViewsCommandHandler(ISender sender) : IRequestHandle foreach (var action in actions) { - var ok = await sender.Send(action.ToInvokeCommand(), cancel); + var ok = await sender.Send(new InvokeRecActionViewCommand() { Action = action }, cancel); if (!ok) switch (action.ErrorAction) { diff --git a/src/ReC.Application/RecActions/Commands/InvokeRecActionViewCommand.cs b/src/ReC.Application/RecActions/Commands/InvokeRecActionViewCommand.cs index 4d3d360..4928018 100644 --- a/src/ReC.Application/RecActions/Commands/InvokeRecActionViewCommand.cs +++ b/src/ReC.Application/RecActions/Commands/InvokeRecActionViewCommand.cs @@ -19,11 +19,6 @@ public record InvokeRecActionViewCommand : IRequest public RecActionViewDto Action { get; set; } = null!; } -public static class InvokeRecActionViewCommandExtensions -{ - public static InvokeRecActionViewCommand ToInvokeCommand(this RecActionViewDto dto) => new() { Action = dto }; -} - public class InvokeRecActionViewCommandHandler( ISender sender, IHttpClientFactory clientFactory,