--- phase: 03- plan: 04 type: execute wave: 3 depends_on: - 03-gateway-infrastructure-update files_modified: - Fengling.Platform.Infrastructure/Extensions.cs - Fengling.Platform.Infrastructure/GatewayExtensions.cs autonomous: true requirements: - GATEWAY-RESTRUCTURE-07 must_haves: truths: - "Extensions.cs 注册 IClusterStore 而非 IInstanceStore" - "GatewayExtensions 可独立使用" --- # 计划 04: 更新 Extensions 和 DI 注册 ## 目标 更新 Extensions.cs 以注册新的 IClusterStore,清理旧的 IInstanceStore 注册。 **目的:** 完成 DI 容器配置的更新,使新服务可被注入使用。 **输出:** 更新的 Extensions.cs。 ## 上下文 @Fengling.Platform.Infrastructure/Extensions.cs @Fengling.Platform.Infrastructure/GatewayExtensions.cs ## 任务 任务 1: 更新 Extensions.cs Fengling.Platform.Infrastructure/Extensions.cs 在 AddPlatformCore 方法中: 1. 移除旧注册: - 移除 services.AddScoped<IInstanceStore, InstanceStore<TContext>>() - 移除 services.AddScoped<IRouteManager, RouteManager>()(如果之前在 Gateway 部分) 2. 添加新注册: - 添加 services.AddScoped<IClusterStore, ClusterStore<TContext>>() 注意:保持与现有 GatewayExtensions 的兼容性。 dotnet build 通过 Extensions.cs 已更新 任务 2: 更新 GatewayExtensions.cs(如需要) Fengling.Platform.Infrastructure/GatewayExtensions.cs 检查 GatewayExtensions.cs: - 如果已注册 IClusterStore,确保与 Extensions.cs 一致 - 如果需要,添加注释说明两种注册方式 dotnet build 通过 GatewayExtensions 检查完成 ## 验证 - [ ] Extensions.cs 已更新 - [ ] Build 无错误通过 ## 成功标准 Gateway 模块重构完成,所有服务正确注册。