| phase |
plan |
type |
wave |
depends_on |
files_modified |
autonomous |
requirements |
user_setup |
must_haves |
| 04-gateway-entity-update |
01 |
execute |
1 |
|
| src/Services/GatewayService.cs |
| src/Program.cs |
|
true |
|
|
| truths |
artifacts |
key_links |
| 编译错误已修复 |
| GatewayService 使用新的 IClusterStore 接口 |
| 实例操作改为通过 Cluster.Destinations 管理 |
|
| path |
provides |
| src/Services/GatewayService.cs |
GatewayService 使用 IClusterStore |
|
| path |
provides |
| src/Program.cs |
依赖注入更新 |
|
|
| from |
to |
via |
| GatewayService |
IClusterStore |
依赖注入 |
|
|
|
适配 Platform 1.0.12 中的 Gateway 实体重构,修复编译错误,更新 Console 代码以使用新的 GwCluster/GwDestination/GwTenantRoute 模型。
@.planning/docs/gateway-entity-changes-1.0.12.md
编译错误
当前编译错误:
error CS0246: IInstanceStore 找不到
变更摘要
- IInstanceStore 已移除 - 实例现在是 GwCluster 的内嵌对象
- IClusterStore 是新接口 - 包含 Destination 管理方法
- 数据模型变化:
- GatewayInstance → GwDestination(内嵌值对象)
- GatewayCluster → GwCluster(聚合根,包含 Destinations)
- 路由通过 ClusterId 关联到集群
任务 1: 更新 Program.cs 依赖注入
src/Program.cs
1. 移除 IInstanceStore 的注入(如果有)
2. 添加 IClusterStore 的注入:
```csharp
builder.Services.AddScoped>();
```
3. 确保使用正确的 PlatformDbContext
dotnet build --no-restore 2>&1 | head -30
Program.cs 依赖注入已更新
任务 2: 更新 GatewayService 使用 IClusterStore
src/Services/GatewayService.cs
1. 移除 IInstanceStore 依赖
2. 添加 IClusterStore 依赖注入
3. 更新实例相关方法:
- GetInstancesAsync → 从 Cluster.Destinations 获取
- AddInstanceAsync → 使用 IClusterStore.AddDestinationAsync
- RemoveInstanceAsync → 使用 IClusterStore.RemoveDestinationAsync
- UpdateInstanceWeightAsync → 使用 IClusterStore.UpdateDestinationAsync
4. 更新数据模型映射:
- GatewayInstanceDto → 从 GwDestination 映射
- GatewayClusterDto → 从 GwCluster 映射
dotnet build --no-restore 2>&1 | head -30
GatewayService 已更新为使用 IClusterStore
任务 3: 验证编译通过
运行完整编译验证:
```bash
dotnet build src/Fengling.Console.csproj
```
确保没有编译错误。
dotnet build src/Fengling.Console.csproj 2>&1 | tail -10
编译通过,无错误
1. dotnet build 编译通过
2. GatewayService 使用 IClusterStore
3. 实例操作通过 Cluster.Destinations 管理
<success_criteria>
完成后创建 `.planning/phases/04-gateway-entity-update/04-SUMMARY.md`