using AuroraDesk.Core.Interfaces;
using AuroraDesk.Infrastructure.Services;
using Microsoft.Extensions.DependencyInjection;
namespace AuroraDesk.Infrastructure.Extensions;
///
/// 服务集合扩展方法(基础设施层)
///
public static class ServiceCollectionExtensions
{
///
/// 添加业务服务
///
/// 服务集合
/// 服务集合
public static IServiceCollection AddBusinessServices(this IServiceCollection services)
{
// 注册业务服务(接口在 Core 层,实现在 Infrastructure 层)
services.AddTransient();
services.AddTransient();
// 注册资源服务
services.AddSingleton();
// 注册图标服务(使用单例模式缓存图标数据)
services.AddSingleton();
return services;
}
///
/// 添加导航服务(必须在 AddViewModels 之后调用,因为 NavigationService 依赖 IPageViewModelFactory)
///
/// 服务集合
/// 服务集合
public static IServiceCollection AddNavigationService(this IServiceCollection services)
{
// 注册导航服务(接口在 Core 层,实现在 Infrastructure 层)
// 注意:需要在 Presentation 层的 AddViewModels 之后调用,因为它依赖 IPageViewModelFactory
services.AddTransient();
// 注册导航状态管理服务(重构新增,分离状态管理职责)
services.AddTransient();
// 注册标签页管理服务(重构新增,分离标签页管理职责)
services.AddTransient();
// 注册节点画布服务
services.AddSingleton();
return services;
}
}