using Microsoft.eShopWeb.ApplicationCore.Interfaces; using Microsoft.eShopWeb.ApplicationCore.Services; using Microsoft.eShopWeb.Infrastructure.Data; using Microsoft.eShopWeb.Infrastructure.Data.Queries; using Microsoft.eShopWeb.Infrastructure.Logging; using Microsoft.eShopWeb.Infrastructure.Services; namespace Microsoft.eShopWeb.Web.Configuration; public static class ConfigureCoreServices { public static IServiceCollection AddCoreServices(this IServiceCollection services, IConfiguration configuration) { services.AddScoped(typeof(IReadRepository<>), typeof(EfRepository<>)); services.AddScoped(typeof(IRepository<>), typeof(EfRepository<>)); services.AddScoped(); services.AddScoped(); services.AddScoped(); var catalogSettings = configuration.Get() ?? new CatalogSettings(); services.AddSingleton(new UriComposer(catalogSettings)); services.AddScoped(typeof(IAppLogger<>), typeof(LoggerAdapter<>)); services.AddTransient(); return services; } }