using API.Data; using API.Helpers; using API.Interfaces; using API.Services; using AutoMapper; using Hangfire; using Hangfire.LiteDB; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace API.Extensions { public static class ApplicationServiceExtensions { public static IServiceCollection AddApplicationServices(this IServiceCollection services, IConfiguration config) { services.AddAutoMapper(typeof(AutoMapperProfiles).Assembly); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddDbContext(options => { options.UseSqlite(config.GetConnectionString("DefaultConnection")); }); services.AddHangfire(configuration => configuration .UseSimpleAssemblyNameTypeSerializer() .UseRecommendedSerializerSettings() .UseLiteDbStorage()); // Add the processing server as IHostedService services.AddHangfireServer(); return services; } } }