GFramework/GFramework.Core/command/AbstractAsyncCommand.cs
GeWuYou 21c5d1bc68 refactor(command): 重构命令和查询抽象基类以支持输入参数分离
- 将 AbstractAsyncCommand 拆分为 AbstractAsyncCommand 和 AbstractAsyncCommandWithInput
- 将 AbstractAsyncCommand<TInput, TResult> 移至新的 AbstractAsyncCommandWithResult 类
- 将 AbstractCommand 拆分为 AbstractCommand 和 AbstractCommandWithInput
- 将 AbstractCommand<TInput, TResult> 移至新的 AbstractCommandWithResult 类
- 将 AbstractAsyncQuery 简化为不带输入参数的版本
- 将 AbstractQuery 简化为不带输入参数的版本
- 创建新的 AbstractAsyncQueryWithResult 类处理带输入参数的异步查询
- 创建新的 AbstractQueryWithResult 类处理带输入参数的同步查询
2026-01-26 13:03:50 +08:00

29 lines
899 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.

using GFramework.Core.Abstractions.command;
using GFramework.Core.rule;
namespace GFramework.Core.command;
/// <summary>
/// 异步命令的抽象基类实现了IAsyncCommand接口
/// 提供异步命令执行的基础框架和上下文感知功能
/// </summary>
public abstract class AbstractAsyncCommand : ContextAwareBase, IAsyncCommand
{
/// <summary>
/// 执行异步命令的实现方法
/// 该方法通过调用受保护的抽象方法OnExecuteAsync来执行具体的命令逻辑
/// </summary>
/// <returns>表示异步操作的任务</returns>
async Task IAsyncCommand.ExecuteAsync()
{
await OnExecuteAsync();
}
/// <summary>
/// 子类必须实现的异步执行方法
/// 包含具体的命令执行逻辑
/// </summary>
/// <returns>表示异步操作的任务</returns>
protected abstract Task OnExecuteAsync();
}