From d1e8f619f577a3fe00ba8249dffad73f6c3b596c Mon Sep 17 00:00:00 2001 From: TekH Date: Thu, 27 Nov 2025 11:20:41 +0100 Subject: [PATCH] Refactor RecActionDto and add InvokeRecActionCommand Converted RecActionDto from class to record for immutability and value-based equality. Added nullable properties `ActionId` and `ProfileId` to RecActionDto. Introduced InvokeRecActionCommand.cs, which includes: - A new InvokeRecActionCommand record inheriting from RecActionDto. - Constructors for initializing InvokeRecActionCommand. - An extension method `ToInvokeCommand` for converting RecActionDto to InvokeRecActionCommand. --- .../Common/Dto/RecActionDto.cs | 2 +- .../Commands/InvokeRecActionCommand.cs | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/ReC.Application/RecActions/Commands/InvokeRecActionCommand.cs diff --git a/src/ReC.Application/Common/Dto/RecActionDto.cs b/src/ReC.Application/Common/Dto/RecActionDto.cs index 71bdedd..717b350 100644 --- a/src/ReC.Application/Common/Dto/RecActionDto.cs +++ b/src/ReC.Application/Common/Dto/RecActionDto.cs @@ -1,6 +1,6 @@ namespace ReC.Application.Common.Dto; -public class RecActionDto +public record RecActionDto { public long? ActionId { get; init; } diff --git a/src/ReC.Application/RecActions/Commands/InvokeRecActionCommand.cs b/src/ReC.Application/RecActions/Commands/InvokeRecActionCommand.cs new file mode 100644 index 0000000..2821435 --- /dev/null +++ b/src/ReC.Application/RecActions/Commands/InvokeRecActionCommand.cs @@ -0,0 +1,20 @@ +using ReC.Application.Common.Dto; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ReC.Application.RecActions.Commands; + +public record InvokeRecActionCommand : RecActionDto +{ + public InvokeRecActionCommand(RecActionDto root) : base(root) { } + + public InvokeRecActionCommand() { } +} + +public static class InvokeRecActionCommandExtensions +{ + public static InvokeRecActionCommand ToInvokeCommand(this RecActionDto dto) => new(dto); +}