Как заинджекать мне для сервиса интерфейс?
Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: X.Services.Interfaces.ServiceInterfaces.IWishListItemService Lifetime: Scoped ImplementationType: X.Infrastructure.Business.Services.WishListItemService': Unable to resolve service for type 'X.Domain.Interfaces.EFInterfaces.IWishListItemRepository' while attempting to activate 'X.Infrastructure.Business.Services.WishListItemService'.) (Error while validating the service descriptor 'ServiceType: X.Services.Interfaces.ServiceInterfaces.IWishListItemService Lifetime: Scoped ImplementationType: X.Infrastructure.Business.Services.WishListItemService': Unable to resolve service for type 'X.Domain.Interfaces.EFInterfaces.IWishListItemRepository' while attempting to activate 'X.Infrastructure.Business.Services.WishListItemService'.)
Сервис:
public class WishListItemService : IWishListItemService
{
private readonly IMapper _mapper;
private readonly IUnitOfWork _unitOfWork;
private readonly IWishListItemRepository _wishListItemRepository;
private readonly IProductDetailsRepository _productDetailsRepository;
public WishListItemService(IMapper mapper, IUnitOfWork unitOfWork,
IWishListItemRepository wishListItemService, IProductDetailsRepository productDetailsRepository)
{
_wishListItemRepository = wishListItemService;
_productDetailsRepository = productDetailsRepository;
_unitOfWork = unitOfWork;
_mapper = mapper;
}
Кoнтроллер:
public class WishListItemController : ControllerBase
{
private readonly IMapper _mapper;
private readonly IWishListItemService _wishListItemService;
public WishListItemController(IWishListItemService wishListItemService, IMapper mapper)
{
_mapper = mapper;
_wishListItemService = wishListItemService;
}