GFramework/GFramework.Cqrs/ICqrsRequestInvokerProvider.cs
gewuyou 0c65cd8e38 feat(cqrs): 前移请求调用器生成注册
- 新增 generated request invoker provider seam,并让 registrar 与 dispatcher 复用编译期请求调用元数据

- 扩展 CQRS source generator 发射 request invoker provider 成员与最小 request invoker 方法

- 补充 runtime 与 source-generator 回归测试,并更新 cqrs-rewrite 追踪到 RP-067
2026-04-30 12:10:25 +08:00

27 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using GFramework.Cqrs.Abstractions.Cqrs;
namespace GFramework.Cqrs;
/// <summary>
/// 定义由源码生成器或手写注册器提供的 request invoker 元数据契约。
/// </summary>
/// <remarks>
/// 该 seam 允许运行时在首次创建 request dispatch binding 时,
/// 直接复用编译期已知的请求/响应类型映射,而不是总是通过反射闭合泛型方法生成调用委托。
/// 当当前程序集没有提供匹配项时dispatcher 仍会回退到既有的反射绑定创建路径。
/// </remarks>
public interface ICqrsRequestInvokerProvider
{
/// <summary>
/// 尝试为指定请求/响应类型对提供运行时元数据。
/// </summary>
/// <param name="requestType">请求运行时类型。</param>
/// <param name="responseType">响应运行时类型。</param>
/// <param name="descriptor">命中时返回的 request invoker 元数据。</param>
/// <returns>若当前 provider 可处理该请求/响应类型对则返回 <see langword="true" />;否则返回 <see langword="false" />。</returns>
bool TryGetDescriptor(
Type requestType,
Type responseType,
out CqrsRequestInvokerDescriptor? descriptor);
}