From 4b0208ca565b2bae0c0cb79ff1f8c5cba14940b3 Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 3 Dec 2025 10:16:29 +0100 Subject: [PATCH] Refactor HeaderQueryBehavior for generic request/response Updated HeaderQueryBehavior to support two generic type parameters, TRequest and TResponse, for improved flexibility. Replaced the single TRecAction type parameter and Unit return type with a more generic implementation. Updated where constraints to reflect the new generic types. Modified the Handle method signature and logic to align with the updated generic parameters. --- .../Common/Behaviors/HeaderQueryBehavior.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ReC.Application/Common/Behaviors/HeaderQueryBehavior.cs b/src/ReC.Application/Common/Behaviors/HeaderQueryBehavior.cs index 2f901a9..b154301 100644 --- a/src/ReC.Application/Common/Behaviors/HeaderQueryBehavior.cs +++ b/src/ReC.Application/Common/Behaviors/HeaderQueryBehavior.cs @@ -7,10 +7,11 @@ using System.Text.Json; namespace ReC.Application.Common.Behaviors; -public class HeaderQueryBehavior(IRecDbContext dbContext, ILogger>? logger = null) : IPipelineBehavior - where TRecAction : RecActionDto +public class HeaderQueryBehavior(IRecDbContext dbContext, ILogger>? logger = null) : IPipelineBehavior + where TRequest : RecActionDto + where TResponse : notnull { - public async Task Handle(TRecAction action, RequestHandlerDelegate next, CancellationToken cancel) + public async Task Handle(TRequest action, RequestHandlerDelegate next, CancellationToken cancel) { if (action.HeaderQuery is null) return await next(cancel);