All checks were successful
Publish Platform NuGet Packages / build (push) Successful in 24s
- 修改 GwServiceInstance 和 GwTenantRoute 的 Id 类型为 string
- 使用 Guid.CreateVersion7().ToString("N") 生成默认唯一标识值
- 更新 IInstanceStore、IRouteManager、IRouteStore 接口中的 FindByIdAsync 方法签名,使用 string? 替代 long?
- 调整 InstanceStore、RouteManager 和 RouteStore 中相应方法实现,支持新的 Id 类型
- 保证相关存储及查询接口兼容新的字符串形式主键
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(string? 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);
|
|
}
|