From 1e67b8ae5236ff7806f921df012518c60a233c9c Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Thu, 18 Dec 2025 16:06:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(core):=20=E6=9B=B4=E6=96=B0=E6=9E=B6?= =?UTF-8?q?=E6=9E=84=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9E=E5=80=BC=E5=8F=AF?= =?UTF-8?q?=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改 GetSystem 方法返回值为可空类型 - 修改 GetModel 方法返回值为可空类型 - 修改 GetUtility 方法返回值为可空类型 - 更新对应接口定义以支持可空返回值 --- GFramework.Core/architecture/Architecture.cs | 6 +++--- GFramework.Core/architecture/IArchitecture.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/GFramework.Core/architecture/Architecture.cs b/GFramework.Core/architecture/Architecture.cs index ccf779c..c861df5 100644 --- a/GFramework.Core/architecture/Architecture.cs +++ b/GFramework.Core/architecture/Architecture.cs @@ -144,7 +144,7 @@ public abstract class Architecture : IArchitecture where T : Architecture, /// /// 目标系统类型 /// 对应的系统实例 - public TSystem GetSystem() where TSystem : class, ISystem + public TSystem? GetSystem() where TSystem : class, ISystem { return _mContainer.Get(); } @@ -154,7 +154,7 @@ public abstract class Architecture : IArchitecture where T : Architecture, /// /// 目标模型类型 /// 对应的模型实例 - public TModel GetModel() where TModel : class, IModel + public TModel? GetModel() where TModel : class, IModel { return _mContainer.Get(); } @@ -164,7 +164,7 @@ public abstract class Architecture : IArchitecture where T : Architecture, /// /// 目标工具类型 /// 对应的工具实例 - public TUtility GetUtility() where TUtility : class, IUtility + public TUtility? GetUtility() where TUtility : class, IUtility { return _mContainer.Get(); } diff --git a/GFramework.Core/architecture/IArchitecture.cs b/GFramework.Core/architecture/IArchitecture.cs index dd5c54d..1cf1586 100644 --- a/GFramework.Core/architecture/IArchitecture.cs +++ b/GFramework.Core/architecture/IArchitecture.cs @@ -39,21 +39,21 @@ public interface IArchitecture /// /// 系统类型,必须是class且实现ISystem接口 /// 指定类型的系统实例 - T GetSystem() where T : class, ISystem; + T? GetSystem() where T : class, ISystem; /// /// 从架构中获取指定类型的模型实例 /// /// 模型类型,必须是class且实现IModel接口 /// 指定类型的模型实例 - T GetModel() where T : class, IModel; + T? GetModel() where T : class, IModel; /// /// 从架构中获取指定类型的工具实例 /// /// 工具类型,必须是class且实现IUtility接口 /// 指定类型的工具实例 - T GetUtility() where T : class, IUtility; + T? GetUtility() where T : class, IUtility; /// /// 发送并执行指定的命令