Files
eShopOnWeb/src/Web/Configuration/ConfigureCoreServices.cs
Steve Smith d2412a84a9 Fix Null Warnings (#874)
* Fixing null warnings

* Fix null warnings
Fix other compiler warnings
2023-03-20 11:52:14 -04:00

31 lines
1.2 KiB
C#

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<IBasketService, BasketService>();
services.AddScoped<IOrderService, OrderService>();
services.AddScoped<IBasketQueryService, BasketQueryService>();
var catalogSettings = configuration.Get<CatalogSettings>() ?? new CatalogSettings();
services.AddSingleton<IUriComposer>(new UriComposer(catalogSettings));
services.AddScoped(typeof(IAppLogger<>), typeof(LoggerAdapter<>));
services.AddTransient<IEmailSender, EmailSender>();
return services;
}
}