mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-23 03:04:29 +08:00
- 将 AbstractAsyncCommand 拆分为 AbstractAsyncCommand 和 AbstractAsyncCommandWithInput - 将 AbstractAsyncCommand<TInput, TResult> 移至新的 AbstractAsyncCommandWithResult 类 - 将 AbstractCommand 拆分为 AbstractCommand 和 AbstractCommandWithInput - 将 AbstractCommand<TInput, TResult> 移至新的 AbstractCommandWithResult 类 - 将 AbstractAsyncQuery 简化为不带输入参数的版本 - 将 AbstractQuery 简化为不带输入参数的版本 - 创建新的 AbstractAsyncQueryWithResult 类处理带输入参数的异步查询 - 创建新的 AbstractQueryWithResult 类处理带输入参数的同步查询
29 lines
788 B
C#
29 lines
788 B
C#
using GFramework.Core.Abstractions.query;
|
||
using GFramework.Core.rule;
|
||
|
||
namespace GFramework.Core.query;
|
||
|
||
/// <summary>
|
||
/// 抽象查询类,提供查询操作的基础实现
|
||
/// </summary>
|
||
/// <typeparam name="TResult">查询结果的类型</typeparam>
|
||
public abstract class AbstractQuery<TResult> : ContextAwareBase, IQuery<TResult>
|
||
|
||
{
|
||
/// <summary>
|
||
/// 执行查询操作
|
||
/// </summary>
|
||
/// <returns>查询结果,类型为TResult</returns>
|
||
public TResult Do()
|
||
{
|
||
// 调用抽象方法执行具体的查询逻辑
|
||
return OnDo();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 抽象方法,用于实现具体的查询逻辑
|
||
/// </summary>
|
||
/// <returns>查询结果,类型为TResult</returns>
|
||
protected abstract TResult OnDo();
|
||
}
|