GFramework/GFramework.Core.Abstractions/architecture/IArchitectureContextProvider.cs
GeWuYou 0ed8edf015 refactor(context): 重构上下文管理实现
- 引入 IArchitectureContextProvider 接口解耦上下文获取逻辑
- 创建 GameContextProvider 作为默认上下文提供者
- 添加 ScopedContextProvider 支持多架构实例场景
- 修改源代码生成器使用上下文提供者模式
- 增加 SetContextProvider 方法支持测试和多架构场景
- 添加 RegistryInitializationHookBase 简化注册表初始化逻辑
2026-03-02 12:42:09 +08:00

21 lines
741 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.Core.Abstractions.architecture;
/// <summary>
/// 架构上下文提供者接口,用于解耦上下文获取逻辑
/// </summary>
public interface IArchitectureContextProvider
{
/// <summary>
/// 获取当前的架构上下文
/// </summary>
/// <returns>架构上下文实例</returns>
IArchitectureContext GetContext();
/// <summary>
/// 尝试获取指定类型的架构上下文
/// </summary>
/// <typeparam name="T">架构上下文类型</typeparam>
/// <param name="context">输出的上下文实例</param>
/// <returns>如果成功获取则返回true否则返回false</returns>
bool TryGetContext<T>(out T? context) where T : class, IArchitectureContext;
}