mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 19:03:29 +08:00
- 新增 Architecture 基类与 IArchitecture 接口,实现单例模式与组件注册管理 - 集成 IOC 容器支持系统、模型、工具的依赖注入与生命周期管理 - 实现命令模式基础类 AbstractCommand 与接口 ICommand,支持带返回值命令 - 提供事件系统集成,支持事件的发布与订阅机制 - 添加控制器接口 IController,整合命令发送、事件注册与模型获取能力 - 创建详细的 README 文档说明各组件使用方式与设计模式应用 - 支持命令、查询、事件的统一调度与解耦通信机制
40 lines
1.5 KiB
C#
40 lines
1.5 KiB
C#
using GFramework.framework.events;
|
|
using GFramework.framework.model;
|
|
using GFramework.framework.query;
|
|
using GFramework.framework.rule;
|
|
using GFramework.framework.system;
|
|
using GFramework.framework.utility;
|
|
|
|
namespace GFramework.framework.command;
|
|
|
|
/// <summary>
|
|
/// 命令接口,定义了无返回值命令的基本契约
|
|
/// 该接口继承了多个框架能力接口,使命令可以访问架构、系统、模型、工具,并能够发送事件、命令和查询
|
|
/// </summary>
|
|
public interface ICommand : ICanSetArchitecture, ICanGetSystem, ICanGetModel, ICanGetUtility,
|
|
ICanSendEvent, ICanSendCommand, ICanSendQuery
|
|
{
|
|
/// <summary>
|
|
/// 执行命令的核心方法
|
|
/// 该方法不接受参数且无返回值,具体实现由派生类完成
|
|
/// </summary>
|
|
void Execute();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 带返回值的命令接口,定义了有返回值命令的基本契约
|
|
/// 该接口继承了多个框架能力接口,使命令可以访问架构、系统、模型、工具,并能够发送事件、命令和查询
|
|
/// </summary>
|
|
/// <typeparam name="TResult">命令执行后返回的结果类型</typeparam>
|
|
public interface ICommand<out TResult> : ICanSetArchitecture, ICanGetSystem, ICanGetModel,
|
|
ICanGetUtility,
|
|
ICanSendEvent, ICanSendCommand, ICanSendQuery
|
|
{
|
|
/// <summary>
|
|
/// 执行命令的核心方法
|
|
/// 该方法不接受参数,但会返回指定类型的结果
|
|
/// </summary>
|
|
/// <returns>命令执行后的结果,类型为 TResult</returns>
|
|
TResult Execute();
|
|
}
|