From e4ed16f3e64647abe6a8d388d47969004afb6eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E6=98=9F=E7=B9=81?= Date: Thu, 13 Apr 2023 14:35:55 +0800 Subject: [PATCH] fix: allow model validation failed result to be returned --- .../CommandEndpointHandler.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Cnblogs.Architecture.Ddd.Cqrs.AspNetCore/CommandEndpointHandler.cs b/src/Cnblogs.Architecture.Ddd.Cqrs.AspNetCore/CommandEndpointHandler.cs index 20c5dad..0616ee6 100644 --- a/src/Cnblogs.Architecture.Ddd.Cqrs.AspNetCore/CommandEndpointHandler.cs +++ b/src/Cnblogs.Architecture.Ddd.Cqrs.AspNetCore/CommandEndpointHandler.cs @@ -34,6 +34,12 @@ public CommandEndpointHandler(IMediator mediator, IOptions opti "Expected ICommand<>, but got null, check if your delegate in MapCommand(route, delegate) returned non-null command"); } + if (command is not IBaseRequest) + { + // not command, return as-is + return command; + } + var response = await _mediator.Send(command); if (response is null) {