Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
48e57c8
Replace Mediator runtime with built-in CQRS
GeWuYou Apr 14, 2026
618f073
config(ci): 配置Coderabbit以支持重构分支的自动审查
GeWuYou Apr 14, 2026
195c832
feat(cqrs): 添加CQRS命令查询责任分离架构支持
GeWuYou Apr 14, 2026
f8fa2a8
feat(cqrs): 添加流式命令处理器和自动注册功能
GeWuYou Apr 14, 2026
156fd4d
Merge pull request #220 from GeWuYou/refactor/cqrs-architecture-decou…
GeWuYou Apr 14, 2026
5c112f8
docs(core): 添加 CQRS 和核心框架文档
GeWuYou Apr 14, 2026
115fe65
docs(core): 添加 CQRS 和核心框架文档
GeWuYou Apr 14, 2026
088f02d
docs(core): 添加 CQRS 文档并完善相关扩展方法
GeWuYou Apr 14, 2026
5a2981a
feat(cqrs): 添加 CQRS 命令协程扩展功能
GeWuYou Apr 15, 2026
96ffd49
fix(coroutine): 更新CQRS协程扩展的异常处理文档
GeWuYou Apr 15, 2026
4c0a99d
fix(coroutine): 优化协程扩展中的异常处理机制
GeWuYou Apr 15, 2026
c0e2e9a
docs(coroutine): 更新CqrsCoroutineExtensions文档
GeWuYou Apr 15, 2026
779c521
Merge pull request #221 from GeWuYou/refactor/cqrs-architecture-decou…
GeWuYou Apr 15, 2026
295496e
docs(core): 添加 CQRS 文档并实现架构模块管理
GeWuYou Apr 15, 2026
fd64423
docs(core): 添加 CQRS 架构模式完整文档
GeWuYou Apr 15, 2026
7a6f966
feat(cqrs): 添加 CQRS 处理器注册生成器
GeWuYou Apr 15, 2026
f59e8f7
Merge pull request #222 from GeWuYou/refactor/cqrs-architecture-decou…
GeWuYou Apr 15, 2026
4db7923
docs(core): 添加 CQRS 架构模式详细文档
GeWuYou Apr 15, 2026
27266d0
feat(arch): 添加架构基础类和依赖注入容器实现
GeWuYou Apr 15, 2026
0cd1e9e
feat(ci): 添加CI/CD工作流和CQRS命令接口
GeWuYou Apr 15, 2026
340b6ca
chore(ci): 更新GitHub Actions工作流配置
GeWuYou Apr 15, 2026
49df81e
refactor(tests): 重构 CQRS 处理程序测试架构
GeWuYou Apr 15, 2026
2329cba
fix: apply CodeRabbit auto-fixes
coderabbitai[bot] Apr 15, 2026
a01ec8d
fix(ci): 修复PR扫描的基线和头版本配置
GeWuYou Apr 15, 2026
3dbe105
Merge pull request #223 from GeWuYou/refactor/cqrs-architecture-decou…
GeWuYou Apr 15, 2026
048f96c
feat(core): 添加架构上下文和CQRS运行时实现
GeWuYou Apr 15, 2026
34e140e
feat(ioc): 添加 Microsoft DI 容器适配器和 CI/CD 工作流
GeWuYou Apr 15, 2026
49ed5d0
refactor(tests): 添加CQRS抽象层依赖项
GeWuYou Apr 15, 2026
1c5c5c8
chore(deps): 更新 Meziantou.Analyzer 和 Meziantou.Polyfill 依赖包版本
GeWuYou Apr 15, 2026
28cdf79
refactor(tests): 移除项目警告级别配置
GeWuYou Apr 15, 2026
aba304f
test(cqrs): 添加CQRS处理器注册器单元测试
GeWuYou Apr 15, 2026
ede8a8f
fix(namespace): 修正命名空间
GeWuYou Apr 15, 2026
932235e
refactor(tests): 更新CqrsCoroutineExtensionsTests中的命名空间引用
GeWuYou Apr 15, 2026
e200176
feat(arch): 添加架构上下文实现及完整测试
GeWuYou Apr 15, 2026
f9cc123
chore(project): 初始化项目结构和测试配置
GeWuYou Apr 15, 2026
81897ce
docs(source-generators): 添加源码生成器文档
GeWuYou Apr 15, 2026
82e6332
test(core): 添加架构上下文和依赖注入容器的单元测试
GeWuYou Apr 15, 2026
2425d28
refactor(tests): 更新测试文件以支持Cqrs功能
GeWuYou Apr 15, 2026
a068a5e
test(arch): 优化架构上下文并发测试的超时配置
GeWuYou Apr 15, 2026
fe73d13
chore(tests): 添加Cqrs抽象依赖到架构测试
GeWuYou Apr 15, 2026
d881bd5
refactor(cqrs): 简化接口定义并分离流式命令和查询接口
GeWuYou Apr 15, 2026
f7b4ae9
Merge pull request #224 from GeWuYou/refactor/cqrs-architecture-decou…
GeWuYou Apr 15, 2026
a80ff59
feat(cqrs): 添加CQRS运行时模块和兼容性扩展
GeWuYou Apr 15, 2026
e36c802
feat(cqrs): 添加CQRS处理器基类和测试运行时支持
GeWuYou Apr 15, 2026
1c7558a
refactor(cqrs): 移除旧日志行为并添加CQRS运行时模块
GeWuYou Apr 15, 2026
18337c5
refactor(tests): 移除未使用的 System.Diagnostics 引用
GeWuYou Apr 15, 2026
005c32d
feat(cqrs): 添加CQRS扩展方法兼容层和日志工厂解析器
GeWuYou Apr 15, 2026
12c9c8a
refactor(cqrs): 迁移CQRS基础类型实现并维护程序集兼容性
GeWuYou Apr 15, 2026
b747787
refactor(core): 更新类型转发器和测试文件的命名空间引用
GeWuYou Apr 15, 2026
7e402d9
docs(cqrs): 修正泛型类型参数的XML文档注释
GeWuYou Apr 15, 2026
7a2127b
refactor(cqrs): 更新Cqrs命名空间路径
GeWuYou Apr 15, 2026
ff9b010
refactor(cqrs): 调整基础消息类型的命名空间和程序集布局
GeWuYou Apr 15, 2026
7b63a65
refactor(tests): 重构CQRS类型转发测试以使用新命名空间
GeWuYou Apr 15, 2026
922ad43
fix(cqrs): 修复CQRS命名空间兼容性测试中的类型解析问题
GeWuYou Apr 15, 2026
385893c
Merge pull request #225 from GeWuYou/refactor/cqrs-architecture-decou…
GeWuYou Apr 15, 2026
1973fb2
feat(ioc): 添加Microsoft DI容器适配器和CQRS运行时模块
GeWuYou Apr 15, 2026
a7604de
feat(ioc): 添加 Microsoft DI 容器适配器和 CQRS 运行时模块
GeWuYou Apr 16, 2026
bc93364
feat(cqrs): 添加 CQRS 处理器注册器和源码生成器
GeWuYou Apr 16, 2026
00a1038
refactor(GFramework.Cqrs): 添加全局using引用System.Reflection
GeWuYou Apr 16, 2026
0d9d09b
feat(ioc): 添加Microsoft DI容器适配器及测试
GeWuYou Apr 16, 2026
a4dfc78
feat(ioc): 添加Microsoft DI容器适配器及测试
GeWuYou Apr 16, 2026
21627c0
Merge pull request #226 from GeWuYou/refactor/cqrs-architecture-decou…
GeWuYou Apr 16, 2026
391e3e9
feat(cqrs): 添加CQRS处理器自动注册功能
GeWuYou Apr 16, 2026
06f95db
feat(cqrs): 添加CQRS调度器实现和改进处理器注册机制
GeWuYou Apr 16, 2026
b07da25
refactor(cqrs): 优化并发处理能力
GeWuYou Apr 16, 2026
4951fb0
feat(cqrs): 添加 CQRS 分发器和服务注册生成器
GeWuYou Apr 16, 2026
ba6a358
Merge pull request #228 from GeWuYou/refactor/cqrs-architecture-decou…
GeWuYou Apr 16, 2026
76bb967
feat(cqrs): 添加 CQRS 处理器注册生成器
GeWuYou Apr 16, 2026
f25353d
feat(cqrs-generator): 支持泛型与数组类型重建并优化隐藏处理器绑定
GeWuYou Apr 16, 2026
082b240
feat(cqrs): 添加 CQRS 处理器注册器源代码生成器
GeWuYou Apr 16, 2026
692671a
Merge pull request #230 from GeWuYou/refactor/cqrs-architecture-decou…
GeWuYou Apr 16, 2026
a8386c1
feat(cqrs): 添加 CQRS 分发器实现及缓存测试
GeWuYou Apr 16, 2026
1792faf
refactor(Cqrs): 重构CQRS处理器注册生成逻辑以支持混合注册类型
GeWuYou Apr 16, 2026
eca2d67
feat(cqrs): 添加CQRS处理器注册器源代码生成器
GeWuYou Apr 16, 2026
73b6377
feat(cqrs): 添加CQRS处理器注册器源代码生成器
GeWuYou Apr 16, 2026
31b6285
test(cqrs): 添加 CQRS 分发器缓存功能的单元测试
GeWuYou Apr 16, 2026
45bcffc
test(cqrs): 添加 CQRS 处理器注册生成器测试
GeWuYou Apr 16, 2026
1630775
refactor(tests): 调整全局引用顺序
GeWuYou Apr 16, 2026
e96623b
Merge pull request #232 from GeWuYou/refactor/cqrs-architecture-decou…
GeWuYou Apr 16, 2026
823be21
feat(generator): 添加运行时发现处理器接口的日志名称记录功能
GeWuYou Apr 16, 2026
52e40a1
Merge pull request #233 from GeWuYou/refactor/cqrs-architecture-decou…
GeWuYou Apr 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ reviews:
auto_review:
enabled: true
drafts: false # draft PR 不 review
base_branches:
- refactor/cqrs-architecture-decoupling

chat:
auto_reply: true
20 changes: 11 additions & 9 deletions .github/workflows/auto-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
workflows: ["CI - Build & Test"]
types:
- completed
branches:
- main
workflow_dispatch:
concurrency:
group: auto-tag-main
Expand All @@ -13,15 +15,15 @@ concurrency:
jobs:
auto-tag:
if: >
github.ref == 'refs/heads/main' &&
(
(
github.event_name == 'workflow_run' &&
github.event.workflow_run.conclusion == 'success' &&
contains(github.event.workflow_run.head_commit.message, '[release ci]')
)
||
github.event_name == 'workflow_dispatch'
github.event_name == 'workflow_run' &&
github.event.workflow_run.conclusion == 'success' &&
contains(github.event.workflow_run.head_commit.message, '[release ci]')
)
||
(
github.event_name == 'workflow_dispatch' &&
github.ref == 'refs/heads/main'
)

runs-on: ubuntu-latest
Expand Down Expand Up @@ -61,4 +63,4 @@ jobs:
fi

git tag -a "$TAG" -m "Auto tag $TAG"
git push "https://x-access-token:${PAT}@github.com/${{ github.repository }}.git" "$TAG"
git push "https://x-access-token:${PAT}@github.com/${{ github.repository }}.git" "$TAG"
16 changes: 10 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# CI/CD工作流配置:构建和测试.NET项目
# 该工作流在push到main/master分支或创建pull request时触发
# 该工作流仅在创建或更新面向任意分支的 pull request 时触发
name: CI - Build & Test

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
branches: [ '**' ]

permissions:
contents: read
Expand Down Expand Up @@ -69,9 +67,9 @@ jobs:
# 扫描路径,. 表示扫描整个仓库
path: .
# 基础提交哈希,用于与当前提交进行比较
base: ${{ github.event.before }}
base: ${{ github.event.pull_request.base.sha }}
# 当前提交哈希,作为扫描的目标版本
head: ${{ github.sha }}
head: ${{ github.event.pull_request.head.sha }}

# 构建和测试 job(并行执行)
build-and-test:
Expand Down Expand Up @@ -168,6 +166,12 @@ jobs:
--logger "trx;LogFileName=sg-$RANDOM.trx" \
--results-directory TestResults &

dotnet test GFramework.Cqrs.Tests \
-c Release \
--no-build \
--logger "trx;LogFileName=cqrs-$RANDOM.trx" \
--results-directory TestResults &

dotnet test GFramework.Ecs.Arch.Tests \
-c Release \
--no-build \
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ name: "CodeQL"

# 触发事件配置
# 在以下情况下触发工作流:
# 1. 推送到main分支时
# 2. 针对main分支的拉取请求时
# 3. 每天凌晨2点执行一次
# 1. 针对任意分支的拉取请求时
# 2. 每天凌晨2点执行一次
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
branches: [ '**' ]
schedule:
- cron: '0 2 * * *'

Expand Down
10 changes: 10 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,16 @@ bash scripts/validate-csharp-naming.sh
- Tracking updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended
recovery point.
- Completing code changes without updating the active tracking document is considered incomplete work.
- For any multi-step refactor, migration, or cross-module task, contributors MUST create or adopt a dedicated recovery
document under `local-plan/todos/` before making substantive code changes.
- Recovery documents MUST record the current phase, the active recovery point identifier, known risks, and the next
recommended resume step so another contributor or subagent can continue the work safely.
- Contributors MUST maintain a matching execution trace under `local-plan/traces/` for complex work. The trace should
record the current date, key decisions, validation milestones, and the immediate next step.
- When a task spans multiple commits or is likely to exceed a single agent context window, update both the recovery
document and the trace at each meaningful milestone before pausing or handing work off.
- If subagents are used on a complex task, the main agent MUST capture the delegated scope and any accepted findings in
the active recovery document or trace before continuing implementation.

### Repository Documentation

Expand Down
6 changes: 5 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ Architecture 负责统一生命周期编排,核心阶段包括:

### CQRS

命令与查询分离,支持同步与异步执行。Mediator 模式通过源码生成器集成,以减少模板代码并保持调用路径清晰。
命令与查询分离,支持同步与异步执行。当前版本内建自有 CQRS runtime、行为管道和 handler 自动注册;公开 API 里仍保留少量历史
`Mediator` 命名以兼容旧调用点,但这些别名已进入正式弃用周期:新代码应使用 `Cqrs` 命名入口,旧别名会继续兼容一段时间并计划在未来
major 版本中移除。

### EventBus

Expand Down Expand Up @@ -103,6 +105,8 @@ Architecture 负责统一生命周期编排,核心阶段包括:
- `PriorityGenerator` (`[Priority]`): 生成优先级比较相关实现。
- `EnumExtensionsGenerator` (`[GenerateEnumExtensions]`): 生成枚举扩展能力。
- `ContextAwareGenerator` (`[ContextAware]`): 自动实现 `IContextAware` 相关样板逻辑。
- `CqrsHandlerRegistryGenerator`: 为消费端程序集生成 CQRS handler 注册器,运行时优先使用生成产物,无法覆盖时回退到反射扫描;非默认程序集可通过
`RegisterCqrsHandlersFromAssembly(...)` / `RegisterCqrsHandlersFromAssemblies(...)` 显式接入同一路径。

这些生成器的目标是减少重复代码,同时保持框架层 API 的一致性与可维护性。

Expand Down
40 changes: 36 additions & 4 deletions GFramework.Core.Abstractions/Architectures/IArchitecture.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System.ComponentModel;
using System.Reflection;
using GFramework.Core.Abstractions.Lifecycle;
using GFramework.Core.Abstractions.Model;
using GFramework.Core.Abstractions.Systems;
using GFramework.Core.Abstractions.Utility;
using Microsoft.Extensions.DependencyInjection;

namespace GFramework.Core.Abstractions.Architectures;

Expand Down Expand Up @@ -73,15 +74,46 @@ public interface IArchitecture : IAsyncInitializable, IAsyncDestroyable, IInitia
void RegisterUtility<T>(Action<T>? onCreated = null) where T : class, IUtility;

/// <summary>
/// 注册中介行为管道
/// 用于配置Mediator框架的行为拦截和处理逻辑。
/// 注册 CQRS 请求管道行为。
/// 既支持实现 <c>IPipelineBehavior&lt;,&gt;</c> 的开放泛型行为类型,
/// 也支持绑定到单一请求/响应对的封闭行为类型。
/// </summary>
/// <typeparam name="TBehavior">行为类型,必须是引用类型</typeparam>
void RegisterCqrsPipelineBehavior<TBehavior>()
where TBehavior : class;

/// <summary>
/// 注册 CQRS 请求管道行为。
/// 该成员保留旧名称以兼容历史调用点,内部行为与 <see cref="RegisterCqrsPipelineBehavior{TBehavior}" /> 一致。
/// 新代码不应继续依赖该别名;兼容层计划在未来的 major 版本中移除。
/// 既支持实现 <c>IPipelineBehavior&lt;,&gt;</c> 的开放泛型行为类型,
/// 也支持绑定到单一请求/响应对的封闭行为类型。
/// </summary>
/// <typeparam name="TBehavior">行为类型,必须是引用类型</typeparam>
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete(
"Use RegisterCqrsPipelineBehavior<TBehavior>() instead. This compatibility alias will be removed in a future major version.")]
void RegisterMediatorBehavior<TBehavior>()
where TBehavior : class;

/// <summary>
/// 从指定程序集显式注册 CQRS 处理器。
/// 当处理器位于默认架构程序集之外的模块或扩展程序集中时,可在初始化阶段调用该入口接入对应程序集。
/// </summary>
/// <param name="assembly">包含 CQRS 处理器或生成注册器的程序集。</param>
/// <exception cref="ArgumentNullException"><paramref name="assembly" /> 为 <see langword="null" />。</exception>
/// <exception cref="InvalidOperationException">当前架构的底层容器已冻结,无法继续注册处理器。</exception>
void RegisterCqrsHandlersFromAssembly(Assembly assembly);

/// <summary>
/// 从多个程序集显式注册 CQRS 处理器。
/// 该入口会对程序集集合去重,适用于统一接入多个扩展包或模块程序集。
/// </summary>
/// <param name="assemblies">要接入的程序集集合。</param>
/// <exception cref="ArgumentNullException"><paramref name="assemblies" /> 为 <see langword="null" />。</exception>
/// <exception cref="InvalidOperationException">当前架构的底层容器已冻结,无法继续注册处理器。</exception>
void RegisterCqrsHandlersFromAssemblies(IEnumerable<Assembly> assemblies);

/// <summary>
/// 安装架构模块
/// </summary>
Expand All @@ -101,4 +133,4 @@ void RegisterMediatorBehavior<TBehavior>()
/// </summary>
/// <returns>表示异步等待操作的任务</returns>
Task WaitUntilReadyAsync();
}
}
Loading
Loading