- Updated PlatformDbContext: removed GwTenant/GwServiceInstance DbSets, added GwCluster with EF Core config - Created IClusterStore interface with CRUD and Destination management methods - Created ClusterStore<TContext> implementation with soft delete and embedded Destinations support - Deleted obsolete IInstanceStore and InstanceStore (replaced by IClusterStore) - Updated Extensions.cs and GatewayExtensions.cs to register IClusterStore Plan 03 of Phase 03 complete.
29 lines
888 B
C#
29 lines
888 B
C#
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace Fengling.Platform.Infrastructure;
|
|
|
|
/// <summary>
|
|
/// Gateway 服务扩展方法
|
|
/// </summary>
|
|
public static class GatewayExtensions
|
|
{
|
|
/// <summary>
|
|
/// 注册 Gateway 核心服务
|
|
/// </summary>
|
|
/// <typeparam name="TContext">数据库上下文类型</typeparam>
|
|
/// <param name="services">服务集合</param>
|
|
/// <returns>服务集合</returns>
|
|
public static IServiceCollection AddGatewayCore<TContext>(this IServiceCollection services)
|
|
where TContext : PlatformDbContext
|
|
{
|
|
// 注册 Gateway stores
|
|
services.AddScoped<IRouteStore, RouteStore<TContext>>();
|
|
services.AddScoped<IClusterStore, ClusterStore<TContext>>();
|
|
|
|
// 注册 Gateway managers
|
|
services.AddScoped<IRouteManager, RouteManager>();
|
|
|
|
return services;
|
|
}
|
|
}
|