feat(cordis): 接入上下文组合与模组事务热替换
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
# ShrinkCommand.Integration.EventBus
|
||||
|
||||
`ShrinkCommand` 与 `ShrinkEventBus` 的桥接层。
|
||||
|
||||
## 能力
|
||||
|
||||
- 通过事件请求执行命令
|
||||
- 把命令执行过程发布为 EventBus 生命周期事件
|
||||
- 保持 `ShrinkCommand` 核心不依赖 `ShrinkEventBus`
|
||||
|
||||
## 事件
|
||||
|
||||
- `ShrinkCommandExecuteRequestEvent`
|
||||
- `ShrinkCommandExecutingEvent`
|
||||
- `ShrinkCommandExecutedEvent`
|
||||
- `ShrinkCommandFailedEvent`
|
||||
|
||||
## 接入
|
||||
|
||||
`ShrinkApp.Starter.Basic` 的 ContextLoader 组合根会注册 `ShrinkCommandEventBusComponent`:它注入
|
||||
`shrink.service.command`,激活时接桥,依赖撤回时自动拆桥。独立使用本包时再显式注册:
|
||||
|
||||
```csharp
|
||||
var service = new ShrinkCommandService();
|
||||
service.AutoRegisterAll();
|
||||
service.UseEventBusBridge(new ShrinkCommandEventBusBridgeOptions
|
||||
{
|
||||
ServiceName = "default",
|
||||
DefaultSource = source
|
||||
});
|
||||
```
|
||||
|
||||
请求执行:
|
||||
|
||||
```csharp
|
||||
var result = await ShrinkCommandEventBusBridge.RequestCommandAsync("help", source);
|
||||
```
|
||||
Reference in New Issue
Block a user