GFramework/GFramework.Core/Cqrs/LegacyAsyncCommandDispatchRequestHandler.cs
gewuyou d7293aa475 refactor(core): 统一旧版命令查询到Cqrs运行时
- 重构 Core 兼容命令查询入口,使 legacy SendCommand/SendQuery 通过内部 bridge request 复用统一 CQRS runtime

- 新增 legacy bridge handler 与真实启动路径回归测试,验证默认架构初始化会自动接入统一 pipeline

- 更新 Core 与 CQRS 文档及 cqrs-rewrite 跟踪,记录 Mediator 尚未吸收的能力差距与后续收口方向
2026-05-07 17:20:14 +08:00

25 lines
767 B
C#

// Copyright (c) 2025-2026 GeWuYou
// SPDX-License-Identifier: Apache-2.0
using GFramework.Cqrs.Abstractions.Cqrs;
namespace GFramework.Core.Cqrs;
/// <summary>
/// 处理 legacy 异步无返回值命令的 bridge handler。
/// </summary>
internal sealed class LegacyAsyncCommandDispatchRequestHandler
: LegacyCqrsDispatchHandlerBase, IRequestHandler<LegacyAsyncCommandDispatchRequest, Unit>
{
/// <inheritdoc />
public async ValueTask<Unit> Handle(
LegacyAsyncCommandDispatchRequest request,
CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(request);
PrepareTarget(request.Command);
await request.Command.ExecuteAsync().ConfigureAwait(false);
return Unit.Value;
}
}