mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
feat(core): 更新架构接口返回值可空
- 修改 GetSystem 方法返回值为可空类型 - 修改 GetModel 方法返回值为可空类型 - 修改 GetUtility 方法返回值为可空类型 - 更新对应接口定义以支持可空返回值
This commit is contained in:
parent
30bd571bc1
commit
1e67b8ae52
@ -144,7 +144,7 @@ public abstract class Architecture<T> : IArchitecture where T : Architecture<T>,
|
||||
/// </summary>
|
||||
/// <typeparam name="TSystem">目标系统类型</typeparam>
|
||||
/// <returns>对应的系统实例</returns>
|
||||
public TSystem GetSystem<TSystem>() where TSystem : class, ISystem
|
||||
public TSystem? GetSystem<TSystem>() where TSystem : class, ISystem
|
||||
{
|
||||
return _mContainer.Get<TSystem>();
|
||||
}
|
||||
@ -154,7 +154,7 @@ public abstract class Architecture<T> : IArchitecture where T : Architecture<T>,
|
||||
/// </summary>
|
||||
/// <typeparam name="TModel">目标模型类型</typeparam>
|
||||
/// <returns>对应的模型实例</returns>
|
||||
public TModel GetModel<TModel>() where TModel : class, IModel
|
||||
public TModel? GetModel<TModel>() where TModel : class, IModel
|
||||
{
|
||||
return _mContainer.Get<TModel>();
|
||||
}
|
||||
@ -164,7 +164,7 @@ public abstract class Architecture<T> : IArchitecture where T : Architecture<T>,
|
||||
/// </summary>
|
||||
/// <typeparam name="TUtility">目标工具类型</typeparam>
|
||||
/// <returns>对应的工具实例</returns>
|
||||
public TUtility GetUtility<TUtility>() where TUtility : class, IUtility
|
||||
public TUtility? GetUtility<TUtility>() where TUtility : class, IUtility
|
||||
{
|
||||
return _mContainer.Get<TUtility>();
|
||||
}
|
||||
|
||||
@ -39,21 +39,21 @@ public interface IArchitecture
|
||||
/// </summary>
|
||||
/// <typeparam name="T">系统类型,必须是class且实现ISystem接口</typeparam>
|
||||
/// <returns>指定类型的系统实例</returns>
|
||||
T GetSystem<T>() where T : class, ISystem;
|
||||
T? GetSystem<T>() where T : class, ISystem;
|
||||
|
||||
/// <summary>
|
||||
/// 从架构中获取指定类型的模型实例
|
||||
/// </summary>
|
||||
/// <typeparam name="T">模型类型,必须是class且实现IModel接口</typeparam>
|
||||
/// <returns>指定类型的模型实例</returns>
|
||||
T GetModel<T>() where T : class, IModel;
|
||||
T? GetModel<T>() where T : class, IModel;
|
||||
|
||||
/// <summary>
|
||||
/// 从架构中获取指定类型的工具实例
|
||||
/// </summary>
|
||||
/// <typeparam name="T">工具类型,必须是class且实现IUtility接口</typeparam>
|
||||
/// <returns>指定类型的工具实例</returns>
|
||||
T GetUtility<T>() where T : class, IUtility;
|
||||
T? GetUtility<T>() where T : class, IUtility;
|
||||
|
||||
/// <summary>
|
||||
/// 发送并执行指定的命令
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user