mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
docs(menu): 更新文档导航菜单和API引用格式
- 在核心文档菜单中新增Context上下文和异步初始化页面链接 - 修正API参考文档中泛型类名的显示格式 - 更新事件、查询和规则文档中的控制器相关描述 - 优化故障排除页面的链接指引结构
This commit is contained in:
parent
93b25a19f7
commit
e58179a6a4
@ -71,6 +71,8 @@ export default defineConfig({
|
||||
items: [
|
||||
{ text: '概览', link: '/zh-CN/core/' },
|
||||
{ text: '架构组件', link: '/zh-CN/core/architecture' },
|
||||
{ text: 'Context 上下文', link: '/zh-CN/core/context' },
|
||||
{ text: '异步初始化', link: '/zh-CN/core/async-initialization' },
|
||||
{ text: '命令系统', link: '/zh-CN/core/command' },
|
||||
{ text: '查询系统', link: '/zh-CN/core/query' },
|
||||
{ text: '事件系统', link: '/zh-CN/core/events' },
|
||||
|
||||
@ -197,7 +197,7 @@ public abstract class AbstractCommand : IBelongToArchitecture
|
||||
}
|
||||
```
|
||||
|
||||
### AbstractQuery<T>
|
||||
### AbstractQuery`<T>`
|
||||
|
||||
```csharp
|
||||
public abstract class AbstractQuery<T> : IBelongToArchitecture
|
||||
@ -222,7 +222,7 @@ public abstract class AbstractQuery<T> : IBelongToArchitecture
|
||||
}
|
||||
```
|
||||
|
||||
### BindableProperty<T>
|
||||
### BindableProperty`<T>`
|
||||
|
||||
```csharp
|
||||
public class BindableProperty<T>
|
||||
|
||||
@ -587,7 +587,7 @@ Components (组件)
|
||||
- [`architecture`](./architecture.md) - 提供全局事件系统
|
||||
- [`extensions`](./extensions.md) - 提供事件扩展方法
|
||||
- [`property`](./property.md) - 可绑定属性基于事件实现
|
||||
- [`controller`](./controller.md) - 控制器监听事件
|
||||
- **Controller** - 控制器监听事件(接口定义在 Core.Abstractions 中)
|
||||
- [`model`](./model.md) - 模型发送事件
|
||||
- [`system`](./system.md) - 系统发送和监听事件
|
||||
- [`command`](./command.md) - 与事件配合实现 CQRS
|
||||
|
||||
@ -478,7 +478,6 @@ public class PlayerModel : AbstractModel
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
### 2. 批量查询
|
||||
|
||||
@ -526,6 +525,6 @@ public class GetMultipleItemCountsQuery : AbstractQuery<Dictionary<string, int>>
|
||||
- [`command`](./command.md) - CQRS 的命令部分
|
||||
- [`model`](./model.md) - Query 主要从 Model 获取数据
|
||||
- [`system`](./system.md) - System 中可以发送 Query
|
||||
- [`controller`](./controller.md) - Controller 中可以发送 Query
|
||||
- **Controller** - Controller 中可以发送 Query(接口定义在 Core.Abstractions 中)
|
||||
- [`extensions`](./extensions.md) - 提供 SendQuery 扩展方法
|
||||
- [`architecture`](./architecture.md) - 架构核心,负责查询的分发和执行
|
||||
@ -209,15 +209,21 @@ public interface IContextAware
|
||||
}
|
||||
|
||||
// 框架负责"提供什么"
|
||||
public static class CanSendExtensions
|
||||
/// <summary>
|
||||
/// 发送一个事件
|
||||
/// </summary>
|
||||
/// <typeparam name="TResult">命令执行结果类型</typeparam>
|
||||
/// <param name="contextAware">实现 IContextAware 接口的对象</param>
|
||||
/// <param name="command">要发送的命令</param>
|
||||
/// <returns>命令执行结果</returns>
|
||||
/// <exception cref="ArgumentNullException">当 contextAware 或 command 为 null 时抛出</exception>
|
||||
public static TResult SendCommand<TResult>(this IContextAware contextAware, ICommand<TResult> command)
|
||||
{
|
||||
public static void SendCommand<T>(this ICanSendCommand self, T command)
|
||||
where T : ICommand
|
||||
{
|
||||
// 自动注入架构上下文依赖
|
||||
command.SetContext(self.GetContext());
|
||||
command.Execute();
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(contextAware);
|
||||
ArgumentNullException.ThrowIfNull(command);
|
||||
|
||||
var context = contextAware.GetContext();
|
||||
return context.SendCommand(command);
|
||||
}
|
||||
```
|
||||
|
||||
@ -310,7 +316,7 @@ public class DatabaseCommand : AbstractCommand, ICanAccessDatabase
|
||||
- [`architecture`](./architecture.md) - 定义 IArchitectureContext 接口
|
||||
- [`command`](./command.md) - Command 继承 AbstractCommand (IContextAware)
|
||||
- [`query`](./query.md) - Query 继承 AbstractQuery (IContextAware)
|
||||
- [`controller`](./controller.md) - Controller 实现 ICanSendCommand 等接口
|
||||
- **Controller** - Controller 实现 ICanSendCommand 等接口(接口定义在 Core.Abstractions 中)
|
||||
- [`system`](./system.md) - System 继承 AbstractSystem (IContextAware)
|
||||
- [`model`](./model.md) - Model 继承 AbstractModel (IContextAware)
|
||||
- [`extensions`](./extensions.md) - 基于规则接口提供扩展方法
|
||||
@ -292,10 +292,10 @@ public void Update()
|
||||
|
||||
如果问题仍未解决:
|
||||
|
||||
1. 查看 [常见问题](../faq.md)
|
||||
2. 查看 [API 参考](../api-reference/index.md)
|
||||
1. 查看 [Core 文档](/zh-CN/core/) 了解更多细节
|
||||
2. 查看 [架构组件](/zh-CN/core/architecture) 了解架构设计
|
||||
3. 在 [GitHub Issues](https://github.com/GeWuYou/GFramework/issues) 提交问题
|
||||
4. 查看 [教程](../tutorials/index.md) 中的示例代码
|
||||
4. 查看 [教程](/zh-CN/tutorials/) 中的示例代码
|
||||
|
||||
---
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user