fengling-platform/.planning/phases/03-/03-gateway-infrastructure-update-SUMMARY.md
2026-03-03 16:10:45 +08:00

3.1 KiB
Raw Blame History

phase plan subsystem tags dependency_graph tech_stack key_files decisions metrics
03- 03 Gateway
gateway
infrastructure
cluster
store
efcore
requires provides affects
GwCluster (来自计划 01)
IClusterStore
ClusterStore
PlatformDbContext 更新
Extensions
GatewayExtensions
added patterns
IClusterStore 接口
ClusterStore<TContext> 实现
Manager + Store 模式ASP.NET Core Identity 风格)
泛型 DbContext 约束
软删除
内嵌集合使用 Owned Entity
created modified deleted
Fengling.Platform.Infrastructure/IClusterStore.cs
Fengling.Platform.Infrastructure/ClusterStore.cs
Fengling.Platform.Infrastructure/PlatformDbContext.cs
Fengling.Platform.Infrastructure/Extensions.cs
Fengling.Platform.Infrastructure/GatewayExtensions.cs
Fengling.Platform.Infrastructure/IInstanceStore.cs
Fengling.Platform.Infrastructure/InstanceStore.cs
IClusterStore 遵循 IRouteStore 模式以保持一致性
ClusterStore 对 GwCluster 实体使用软删除
OwnsMany 用于 EF Core 中内嵌的 Destinations 集合
duration completed_date
2026-03-03

阶段 03 - 计划 03: 网关基础设施更新总结

一句话概述

更新 PlatformDbContext 以包含 GwCluster DbSet 和 EF Core 配置,创建 IClusterStore/ClusterStore 以替代已废弃的 IInstanceStore/InstanceStore。

已完成任务

任务 名称 提交 文件
1 更新 PlatformDbContext a655813 PlatformDbContext.cs
2 创建 IClusterStore 接口 a655813 IClusterStore.cs
3 创建 ClusterStore 实现 a655813 ClusterStore.cs
4 删除 IInstanceStore 和 InstanceStore a655813 IInstanceStore.cs, InstanceStore.cs (已删除)

验证结果

  • PlatformDbContext 已更新 - 移除 GwTenant/GwServiceInstance DbSets添加 GwCluster 及 EF Core 配置
  • IClusterStore 接口已创建,包含所有 CRUD + Destination 管理方法
  • ClusterStore 实现已创建,支持软删除
  • 旧的 IInstanceStore/InstanceStore 已删除(被 IClusterStore 替代)
  • 构建通过0 个错误

计划偏差

1. [规则 2 - 自动添加缺失功能] 修复 DI 注册引用

  • 发现时机: 构建验证
  • 问题: Extensions.cs 和 GatewayExtensions.cs 仍引用已删除的 IInstanceStore
  • 修复: 更新两个文件以注册 IClusterStore/ClusterStore
  • 修改文件: Extensions.cs、GatewayExtensions.cs

2. [规则 1 - 自动修复 Bug] 修复 EF Core OwnsMany 配置

  • 发现时机: 构建验证
  • 问题: PlatformDbContext 中 OwnsMany 构建器使用不正确
  • 修复: 更正配置以使用正确的 OwnedMany 模式,包含外键的影子属性
  • 修改文件: PlatformDbContext.cs

认证门槛

无。

备注

基础设施层现已准备好进入下一阶段:

  • GwCluster 聚合已在 DbContext 中正确配置
  • IClusterStore 遵循已建立的 Manager + Store 模式
  • 所有已废弃的 IInstanceStore 引用已被移除
  • DI 注册已在 Extensions.cs 和 GatewayExtensions.cs 中更新