using API.Data; using API.Helpers; using API.Interfaces; using API.Interfaces.Services; using API.Services; using API.Services.Tasks; using AutoMapper; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; 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.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddDbContext(options => { options.UseSqlite(config.GetConnectionString("DefaultConnection")); }); services.AddLogging(loggingBuilder => { var loggingSection = config.GetSection("Logging"); loggingBuilder.AddFile(loggingSection); }); return services; } public static IServiceCollection AddStartupTask(this IServiceCollection services) where T : class, IStartupTask => services.AddTransient(); } }