fengling-console/.planning/phases/04-gateway-entity-update/04-SUMMARY.md
movingsam 154484d2dc
All checks were successful
Build and Push Docker / build (push) Successful in 6m44s
refactor(gateway): adapt to Platform 1.0.12 entity changes
- Remove IInstanceStore DI registration (replaced by IClusterStore)
- Remove GwTenant and GwServiceInstance from ConsoleDbContext config
- Update GatewayService to use Match.Path instead of PathPattern
- Cast RouteStatus enum to int for Status field
- Add 04-SUMMARY.md documentation

BREAKING CHANGE: Gateway entity API changes in Platform 1.0.12
2026-03-04 13:00:11 +08:00

79 lines
1.9 KiB
Markdown
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.

# Phase 4 总结:适配 Platform 1.0.12 Gateway 实体变更
## 概述
本次 Phase 4 成功完成了 Fengling Console 对 Platform 1.0.12 Gateway 实体变更的适配工作。
## 主要变更
### 1. Program.cs 依赖注入更新
**变更内容:**
- 移除了 `IInstanceStore``InstanceStore` 的注册
- 保留了 `IClusterStore``ClusterStore` 的注册
**变更原因:**
Platform 1.0.12 移除了 `IInstanceStore` 接口,实例(Destination)现在是 `GwCluster` 的内嵌对象。
### 2. ConsoleDbContext 实体配置清理
**变更内容:**
- 移除了 `GwTenant` 实体配置(原平台中已移除)
- 移除了 `GwServiceInstance` 实体配置(已重构为 GwDestination
### 3. GatewayService 实体属性适配
**变更内容:**
| 旧属性 | 新属性 | 说明 |
|--------|--------|------|
| `GwTenantRoute.PathPattern` (string) | `GwTenantRoute.Match.Path` ( GwRouteMatch.Path ) | 路由匹配配置从简单字符串升级为复杂对象 |
| `Status = RouteStatus.Active` (enum) | `Status = (int)RouteStatus.Active` (int) | Status 字段为 int 类型,需要显式转换枚举 |
**具体代码变更:**
```csharp
// 旧代码
new GwTenantRoute
{
PathPattern = pathPattern,
Status = RouteStatus.Active,
}
// 新代码
new GwTenantRoute
{
Match = new GwRouteMatch { Path = pathPattern },
Status = (int)RouteStatus.Active,
}
```
```csharp
// 旧代码读取
r.PathPattern
r.Status
// 新代码读取
r.Match.Path
r.Status (已是 int)
```
## 编译结果
✅ 编译成功0 个错误3 个警告(警告为预存在的代码质量问题,与本次变更无关)
## 验证
- [x] `dotnet build` 通过
- [x] 无新增编译错误
## 相关文档
- 实体变更详情:`.planning/docs/gateway-entity-changes-1.0.12.md`
## 下一步
可以考虑的改进:
1. 修复 TenantService.cs 中的警告roleManager 参数未使用)
2. 完善 GatewayService 中的空值处理Match 可能为 null