Change FinalizeDocumentJob to scoped, add ReportCreator

Changed FinalizeDocumentJob DI registration from singleton to scoped for better instance management. Added ReportCreator as a scoped service. Removed unused EnvelopeGenerator.ServiceHost.Jobs.Infrastructure import.
This commit is contained in:
2026-04-09 16:01:51 +02:00
parent bdb3863c07
commit fabfe80666

View File

@@ -1,6 +1,5 @@
using EnvelopeGenerator.ServiceHost.Jobs; using EnvelopeGenerator.ServiceHost.Jobs;
using EnvelopeGenerator.ServiceHost.Jobs.FinalizeDocument; using EnvelopeGenerator.ServiceHost.Jobs.FinalizeDocument;
using EnvelopeGenerator.ServiceHost.Jobs.Infrastructure;
using GdPicture14; using GdPicture14;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
@@ -12,11 +11,12 @@ public static class DependencyInjection
public static IServiceCollection AddFinalizeDocumentJob(this IServiceCollection services, IConfiguration configuration) public static IServiceCollection AddFinalizeDocumentJob(this IServiceCollection services, IConfiguration configuration)
{ {
services.Configure<WorkerOptions>(configuration.GetSection(nameof(WorkerOptions))); services.Configure<WorkerOptions>(configuration.GetSection(nameof(WorkerOptions)));
services.AddSingleton<FinalizeDocumentJob>(); services.AddScoped<FinalizeDocumentJob>();
services.AddScoped<ActionService>(); services.AddScoped<ActionService>();
services.AddSingleton<TempFiles>(); services.AddSingleton<TempFiles>();
services.AddScoped<PDFBurner>(); services.AddScoped<PDFBurner>();
services.AddScoped<PDFMerger>(); services.AddScoped<PDFMerger>();
services.AddScoped<ReportCreator>();
//TODO: Check lifetime of services. They might be singleton or scoped. //TODO: Check lifetime of services. They might be singleton or scoped.
services.AddTransient<GdViewer>(); services.AddTransient<GdViewer>();