From 3998c9ce0bd5b66c049aeb23e8ed89436437a116 Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 3 Dec 2025 10:12:35 +0100 Subject: [PATCH] Refactor BodyQueryBehavior for generic request-response Updated BodyQueryBehavior to support a generic request-response pipeline. Replaced fixed `TRecAction` and `Unit` types with `TRequest` and `TResponse` generics. Added `where` constraints for `TRequest` (`RecActionDto`) and `TResponse` (`notnull`). Updated the `Handle` method signature and return type to align with the new generics. --- .../Common/Behaviors/BodyQueryBehavior.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ReC.Application/Common/Behaviors/BodyQueryBehavior.cs b/src/ReC.Application/Common/Behaviors/BodyQueryBehavior.cs index a124b6c..f79c145 100644 --- a/src/ReC.Application/Common/Behaviors/BodyQueryBehavior.cs +++ b/src/ReC.Application/Common/Behaviors/BodyQueryBehavior.cs @@ -5,11 +5,12 @@ using Microsoft.EntityFrameworkCore; namespace ReC.Application.Common.Behaviors; -public class BodyQueryBehavior(IRecDbContext dbContext) : IPipelineBehavior - where TRecAction : RecActionDto +public class BodyQueryBehavior(IRecDbContext dbContext) : 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.BodyQuery is null) return await next(cancel);