using DigitalData.Modules.Database; using EnvelopeGenerator.ServiceHost.Jobs; using EnvelopeGenerator.ServiceHost.Jobs.FinalizeDocument; using GdPicture14; using Microsoft.Extensions.Options; namespace EnvelopeGenerator.ServiceHost.Extensions; public static class DependencyInjection { [Obsolete("Check obsoleted services")] public static IServiceCollection AddFinalizeDocumentJob(this IServiceCollection services, IConfiguration configuration) { services.Configure(configuration.GetSection(nameof(WorkerOptions))); services.AddSingleton(); services.AddScoped(); services.AddSingleton(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddSingleton(); services.AddScoped(); services.AddSingleton(_ => throw new NotImplementedException()); //TODO: Check lifetime of services. They might be singeton. services.AddTransient(); // Add LicenseManager services.AddTransient(provider => { var options = provider.GetRequiredService>().Value; var licenseManager = new LicenseManager(); licenseManager.RegisterKEY(options.GdPictureLicenseKey); return licenseManager; }); return services; } }