mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-23 03:04:29 +08:00
- 将命令相关抽象接口从command目录迁移至cqrs.command目录 - 新增CommandBase、NotificationBase、QueryBase和RequestBase通用基类 - 统一所有CQRS组件的命名空间为GFramework.Core.Abstractions.cqrs - 更新所有引用位置的using语句指向新的命名空间路径 - 为命令和查询输入接口添加IInput基接口继承 - 在测试文件中同步更新相关的引用路径修改
28 lines
1003 B
C#
28 lines
1003 B
C#
using GFramework.Core.Abstractions.command;
|
|
using GFramework.Core.Abstractions.cqrs.command;
|
|
using GFramework.Core.rule;
|
|
|
|
namespace GFramework.Core.command;
|
|
|
|
/// <summary>
|
|
/// 抽象命令类,实现 ICommand 接口,为具体命令提供基础架构支持
|
|
/// </summary>
|
|
/// <typeparam name="TInput">命令输入参数类型,必须实现 ICommandInput 接口</typeparam>
|
|
/// <param name="input">命令执行所需的输入参数</param>
|
|
public abstract class AbstractCommand<TInput>(TInput input) : ContextAwareBase, ICommand
|
|
where TInput : ICommandInput
|
|
{
|
|
/// <summary>
|
|
/// 执行命令的入口方法,实现 ICommand 接口的 Execute 方法
|
|
/// </summary>
|
|
void ICommand.Execute()
|
|
{
|
|
OnExecute(input);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 命令执行的抽象方法,由派生类实现具体的命令逻辑
|
|
/// </summary>
|
|
/// <param name="input">命令执行所需的输入参数</param>
|
|
protected abstract void OnExecute(TInput input);
|
|
} |