GFramework/GFramework.Core/query/AbstractQueryWithResult.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
954 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.query;
using GFramework.Core.rule;
namespace GFramework.Core.query;
/// <summary>
/// 抽象查询类,提供查询操作的基础实现
/// </summary>
/// <typeparam name="TInput">查询输入参数的类型必须实现IQueryInput接口</typeparam>
/// <typeparam name="TResult">查询结果的类型</typeparam>
public abstract class AbstractQuery<TInput, TResult>(TInput input) : ContextAwareBase, IQuery<TResult>
where TInput : IQueryInput
{
/// <summary>
/// 执行查询操作
/// </summary>
/// <returns>查询结果类型为TResult</returns>
public TResult Do()
{
return OnDo(input);
}
/// <summary>
/// 抽象方法,用于实现具体的查询逻辑
/// </summary>
/// <param name="input">查询输入参数</param>
/// <returns>查询结果类型为TResult</returns>
protected abstract TResult OnDo(TInput input);
}