GFramework/GFramework.Cqrs/CqrsHandlerRegistryAttribute.cs
GeWuYou a80ff59631 feat(cqrs): 添加CQRS运行时模块和兼容性扩展
- 新增ContextAwareMediatorCommandExtensions提供命令扩展方法的兼容性别名
- 新增ContextAwareMediatorExtensions提供CQRS统一接口扩展方法的兼容性别名
- 新增ContextAwareMediatorQueryExtensions提供查询扩展方法的兼容性别名
- 添加CqrsRuntimeModule用于注册CQRS运行时和处理器注册器到依赖注入容器
- 更新IArchitectureContext接口添加新版CQRS请求、命令、查询和通知的统一入口
- 添加架构上下文的CQRS处理器注册相关单元测试
- 配置项目文件以支持多目标框架和包引用管理
2026-04-15 19:42:08 +08:00

19 lines
832 B
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.

namespace GFramework.Cqrs;
/// <summary>
/// 声明程序集内可供运行时直接调用的 CQRS 处理器注册器类型。
/// </summary>
/// <remarks>
/// 该特性通常由源码生成器自动添加到消费端程序集。
/// 运行时读取到该特性后,会优先实例化对应的 <see cref="ICqrsHandlerRegistry" />
/// 以常量时间获取处理器注册映射,而不是遍历程序集中的全部类型。
/// </remarks>
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class CqrsHandlerRegistryAttribute(Type registryType) : Attribute
{
/// <summary>
/// 获取承载 CQRS 处理器注册逻辑的注册器类型。
/// </summary>
public Type RegistryType { get; } = registryType ?? throw new ArgumentNullException(nameof(registryType));
}