using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Bookstore.Domain.Customers; using Bookstore.Domain.Books; using Bookstore.Domain; using Bookstore.Domain.Offers; using Bookstore.Domain.Orders; using Bookstore.Domain.Carts; using Bookstore.Domain.ReferenceData; using Bookstore.Data.Repositories; using Bookstore.Data.FileServices; using Bookstore.Domain.Addresses; using Bookstore.Data.ImageValidationServices; using Bookstore.Data.ImageResizeService; namespace Bookstore.Web.Startup { public static class DependencyInjectionSetup { public static WebApplicationBuilder ConfigureDependencyInjection(this WebApplicationBuilder builder) { builder.Services.AddHttpContextAccessor(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(typeof(IPaginatedList<>), typeof(PaginatedList<>)); if (builder.Environment.IsDevelopment()) { builder.Services.AddTransient(x => new LocalFileService(builder.Environment.WebRootPath)); builder.Services.AddTransient(); } else { builder.Services.AddTransient(); builder.Services.AddTransient(); } return builder; } } }