GFramework/GFramework.Core/architecture/ArchitectureServices.cs
GwWuYou 56ff201f94 feat(architecture): 为架构服务添加上下文支持并改进事件系统
- 在 ArchitectureServices 中添加 SetContext 和 GetContext 方法
- 为 IArchitectureServices 接口添加 IContextAware 继承
- 在架构初始化过程中设置服务上下文
- 将事件系统的 GetEvent 方法替换为 GetOrAddEvent 方法
- 重构测试类添加测试装置和拆卸逻辑
- 为测试类添加 NonParallelizable 特性确保测试隔离
2025-12-29 21:42:52 +08:00

25 lines
710 B
C#

using GFramework.Core.Abstractions.architecture;
using GFramework.Core.Abstractions.events;
using GFramework.Core.Abstractions.ioc;
using GFramework.Core.events;
using GFramework.Core.ioc;
namespace GFramework.Core.architecture;
public class ArchitectureServices : IArchitectureServices
{
private IArchitectureContext _context = null!;
public IIocContainer Container { get; } = new IocContainer();
public ITypeEventSystem TypeEventSystem { get; } = new TypeEventSystem();
public void SetContext(IArchitectureContext context)
{
_context = context;
Container.SetContext(context);
}
public IArchitectureContext GetContext()
{
return _context;
}
}