- 新增 GatewayAggregate 领域实体 (GwTenant, GwTenantRoute, GwServiceInstance) - 新增 IRouteStore, RouteStore, IInstanceStore, InstanceStore - 新增 IRouteManager, RouteManager - 合并 GatewayDbContext 到 PlatformDbContext - 统一 Extensions.AddPlatformCore 注册所有服务
39 lines
1.5 KiB
C#
39 lines
1.5 KiB
C#
using Microsoft.AspNetCore.Identity;
|
|
using Fengling.Platform.Domain.AggregatesModel.GatewayAggregate;
|
|
|
|
namespace Fengling.Platform.Infrastructure;
|
|
|
|
/// <summary>
|
|
/// 路由管理器实现
|
|
/// </summary>
|
|
public class RouteManager : IRouteManager
|
|
{
|
|
private readonly IRouteStore _store;
|
|
|
|
public RouteManager(IRouteStore store)
|
|
{
|
|
_store = store;
|
|
}
|
|
|
|
public virtual Task<GwTenantRoute?> FindByIdAsync(long? id, CancellationToken cancellationToken = default)
|
|
=> _store.FindByIdAsync(id, cancellationToken);
|
|
|
|
public virtual Task<GwTenantRoute?> FindByTenantCodeAsync(string tenantCode, CancellationToken cancellationToken = default)
|
|
=> _store.FindByTenantCodeAsync(tenantCode, cancellationToken);
|
|
|
|
public virtual Task<IList<GwTenantRoute>> GetAllAsync(CancellationToken cancellationToken = default)
|
|
=> _store.GetAllAsync(cancellationToken);
|
|
|
|
public virtual Task<IdentityResult> CreateRouteAsync(GwTenantRoute route, CancellationToken cancellationToken = default)
|
|
{
|
|
route.CreatedTime = DateTime.UtcNow;
|
|
return _store.CreateAsync(route, cancellationToken);
|
|
}
|
|
|
|
public virtual Task<IdentityResult> UpdateRouteAsync(GwTenantRoute route, CancellationToken cancellationToken = default)
|
|
=> _store.UpdateAsync(route, cancellationToken);
|
|
|
|
public virtual Task<IdentityResult> DeleteRouteAsync(GwTenantRoute route, CancellationToken cancellationToken = default)
|
|
=> _store.DeleteAsync(route, cancellationToken);
|
|
}
|