GFramework/GFramework.Core/Query/QueryExecutor.cs
GeWuYou fb14d7122c docs(style): 更新文档中的命名空间导入格式
- 将所有小写的命名空间导入更正为首字母大写格式
- 统一 GFramework 框架的命名空间引用规范
- 修复 core、ecs、godot 等模块的命名空间导入错误
- 标准化文档示例代码中的 using 语句格式
- 确保所有文档中的命名空间引用保持一致性
- 更新 global using 语句以匹配正确的命名空间格式
2026-03-10 07:18:49 +08:00

28 lines
1.0 KiB
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;
namespace GFramework.Core.Query;
/// <summary>
/// QueryExecutor 类负责执行查询操作,实现 IQueryExecutor 接口。
/// 该类是密封的,防止被继承。
/// </summary>
public sealed class QueryExecutor : IQueryExecutor
{
/// <summary>
/// 执行指定的查询并返回结果。
/// 该方法通过调用查询对象的 Do 方法来获取结果。
/// </summary>
/// <typeparam name="TResult">查询结果的类型。</typeparam>
/// <param name="query">要执行的查询对象,必须实现 IQuery&lt;TResult&gt; 接口。</param>
/// <returns>查询执行的结果,类型为 TResult。</returns>
public TResult Send<TResult>(IQuery<TResult> query)
{
// 验证查询参数不为 null如果为 null 则抛出 ArgumentNullException 异常
ArgumentNullException.ThrowIfNull(query);
// 调用查询对象的 Do 方法执行查询并返回结果
return query.Do();
}
}