mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 18:16:36 +00:00
big refactoring. get rid of static properties and coupled architecture. prepare system for integration tests
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using Azaion.Common.Database;
|
||||
using Azaion.Common.DTO;
|
||||
using Azaion.Common.DTO.Config;
|
||||
using Azaion.Common.Services;
|
||||
using Azaion.Common.Services.Inference;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Azaion.Common.Infrastructure;
|
||||
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
public static IServiceCollection AddAzaionInfrastructure(this IServiceCollection services)
|
||||
{
|
||||
services.AddSingleton<IFileSystem, PhysicalFileSystem>();
|
||||
services.AddSingleton<IProcessLauncher, ProcessLauncher>();
|
||||
services.AddSingleton<IAnnotationPathResolver>(sp =>
|
||||
new AnnotationPathResolver(sp.GetRequiredService<IOptions<DirectoriesConfig>>().Value));
|
||||
services.AddSingleton<IDetectionClassProvider, DetectionClassProvider>();
|
||||
services.AddSingleton<IAnnotationRepository, AnnotationRepository>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddAzaionConfiguration(this IServiceCollection services)
|
||||
{
|
||||
services.AddSingleton<IConfigurationStore>(sp =>
|
||||
new FileConfigurationStore(Constants.CONFIG_PATH, sp.GetRequiredService<IFileSystem>()));
|
||||
services.AddSingleton<IConfigUpdater, ConfigUpdater>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddAzaionServices(this IServiceCollection services)
|
||||
{
|
||||
services.AddSingleton<IDbFactory, DbFactory>();
|
||||
services.AddSingleton<FailsafeAnnotationsProducer>();
|
||||
services.AddSingleton<IAnnotationService, AnnotationService>();
|
||||
services.AddSingleton<IGalleryService, GalleryService>();
|
||||
services.AddSingleton<IInferenceService, InferenceService>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user