using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using OrpaonVision.ConfigApp.Annotation.Options; using OrpaonVision.ConfigApp.Annotation.Services; using OrpaonVision.ConfigApp.Configuration.Services; using OrpaonVision.ConfigApp.Infrastructure.Diagnostics; using OrpaonVision.ConfigApp.Infrastructure.Logging; using OrpaonVision.ConfigApp.Infrastructure.Persistence; using OrpaonVision.ConfigApp.Infrastructure.Persistence.Options; using OrpaonVision.ConfigApp.Infrastructure.Services; using OrpaonVision.ConfigApp.Infrastructure.Options; using OrpaonVision.ConfigApp.ViewModels; using OrpaonVision.Core.Abstractions; using OrpaonVision.Core.Annotation; using OrpaonVision.Core.Configuration; using OrpaonVision.Core.Production; using OrpaonVision.Core.Security; using OrpaonVision.Core.Training; namespace OrpaonVision.ConfigApp.DependencyInjection; /// /// ConfigApp 服务注册扩展。 /// public static class ServiceCollectionExtensions { /// /// 注册 ConfigApp 应用服务。 /// /// 服务集合。 /// 服务集合。 public static IServiceCollection AddConfigAppServices(this IServiceCollection services, IConfiguration configuration) { var cvatOptions = new CvatOptions(); configuration.GetSection("Cvat").Bind(cvatOptions); var persistenceOptions = new PersistenceOptions(); configuration.GetSection("Persistence").Bind(persistenceOptions); var sessionPersistenceOptions = new SessionPersistenceOptions(); configuration.GetSection("SessionPersistence").Bind(sessionPersistenceOptions); var modelPackageOptions = new ModelPackageOptions(); configuration.GetSection("ModelPackage").Bind(modelPackageOptions); var runtimeDeploymentSnapshotOptions = new RuntimeDeploymentSnapshotOptions(); configuration.GetSection("RuntimeDeploymentSnapshot").Bind(runtimeDeploymentSnapshotOptions); services.AddSingleton(cvatOptions); services.AddSingleton(persistenceOptions); services.AddSingleton(sessionPersistenceOptions); services.AddSingleton(modelPackageOptions); services.AddSingleton(runtimeDeploymentSnapshotOptions); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); // 训练任务管理服务 services.AddSingleton(); // 模型包管理服务 services.AddSingleton(); // 运行时部署快照管理服务 services.AddSingleton(); // 规则校验服务 services.AddSingleton(); // 用户权限管理服务 services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); // 产品会话服务 services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); // ViewModel services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); return services; } }