From e3fa0db9928b4886559674a035d82cc7c38a233f Mon Sep 17 00:00:00 2001
From: gewuyou <95328647+GeWuYou@users.noreply.github.com>
Date: Thu, 7 May 2026 08:58:09 +0800
Subject: [PATCH 1/3] =?UTF-8?q?refactor(core):=20=E6=94=B6=E6=95=9B?=
=?UTF-8?q?=E5=8D=95=E6=B4=BB=E5=8A=A8=E4=B8=8A=E4=B8=8B=E6=96=87=E4=B8=8E?=
=?UTF-8?q?=E9=A2=84=E5=86=BB=E7=BB=93=E6=9F=A5=E8=AF=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 收敛 GameContext 为单活动上下文模型并保留类型别名兼容查找
- 统一 MicrosoftDiContainer 预冻结实例读取路径并补充 CQRS 注册阶段提示
- 更新 Core 测试、上下文文档与 ai-plan 追踪记录
---
.../Ioc/IIocContainer.cs | 17 ++++
.../Architectures/ContextProviderTests.cs | 12 +--
.../Architectures/GameContextTests.cs | 89 +++++++++++++------
.../Ioc/MicrosoftDiContainerTests.cs | 66 ++++++++++++++
.../Rule/ContextAwareTests.cs | 15 +---
GFramework.Core/Architectures/GameContext.cs | 68 +++++++++++---
.../Architectures/GameContextProvider.cs | 10 ++-
GFramework.Core/Ioc/MicrosoftDiContainer.cs | 32 +++----
GFramework.Core/Rule/ContextAwareBase.cs | 2 +-
ai-plan/public/README.md | 6 ++
.../todos/single-context-priority-tracking.md | 53 +++++++++++
.../traces/single-context-priority-trace.md | 32 +++++++
docs/zh-CN/core/context.md | 2 +-
docs/zh-CN/core/rule.md | 4 +-
.../context-aware-generator.md | 2 +-
15 files changed, 326 insertions(+), 84 deletions(-)
create mode 100644 ai-plan/public/single-context-priority/todos/single-context-priority-tracking.md
create mode 100644 ai-plan/public/single-context-priority/traces/single-context-priority-trace.md
diff --git a/GFramework.Core.Abstractions/Ioc/IIocContainer.cs b/GFramework.Core.Abstractions/Ioc/IIocContainer.cs
index 9db0bd3e..44ed3b29 100644
--- a/GFramework.Core.Abstractions/Ioc/IIocContainer.cs
+++ b/GFramework.Core.Abstractions/Ioc/IIocContainer.cs
@@ -141,6 +141,10 @@ public interface IIocContainer : IContextAware, IDisposable
///
/// 期望获取的实例类型
/// 找到的第一个实例;如果未找到则返回 null
+ ///
+ /// 在 之前,该查询只保证返回已经物化为实例绑定的服务。
+ /// 仅通过工厂或实现类型注册的服务在预冻结阶段可能不可见;若需要完整激活语义,请先冻结容器。
+ ///
T? Get() where T : class;
///
@@ -149,6 +153,10 @@ public interface IIocContainer : IContextAware, IDisposable
///
/// 期望获取的实例类型
/// 找到的第一个实例;如果未找到则返回 null
+ ///
+ /// 在 之前,该查询只保证返回已经物化为实例绑定的服务。
+ /// 仅通过工厂或实现类型注册的服务在预冻结阶段可能不可见;若需要完整激活语义,请先冻结容器。
+ ///
object? Get(Type type);
@@ -174,6 +182,9 @@ public interface IIocContainer : IContextAware, IDisposable
///
/// 期望获取的实例类型
/// 所有符合条件的实例列表;如果没有则返回空数组
+ ///
+ /// 在 之前,该查询只会枚举当前已经可见的实例绑定,不会主动执行工厂或创建实现类型。
+ ///
IReadOnlyList GetAll() where T : class;
///
@@ -181,6 +192,9 @@ public interface IIocContainer : IContextAware, IDisposable
///
/// 期望获取的实例类型
/// 所有符合条件的实例列表;如果没有则返回空数组
+ ///
+ /// 在 之前,该查询只会枚举当前已经可见的实例绑定,不会主动执行工厂或创建实现类型。
+ ///
IReadOnlyList