I am trying to implement dependency injection with Simple Injector and ASP.NET Core. I have a class library for services and another class library for data access with repositories. My problem is, I have implemented dependency injection in my startup class (web api) to reference my services. Now I need to do the same in the services to injection dependency for repositories. But I don't have a startup class in my class library (services class library), so how can I do it?
public interface IBaseService<TEntity> where TEntity : class
{ }
Account service
public interface IAccountService : IBaseService<User>
{ }
private readonly IAccountRepository _repository;
private readonly IUnitOfWork _unitOfWork;
public AccountService(IAccountRepository repository, IUnitOfWork unitOfWork) : base (repository, unitOfWork)
{
_repository = repository;
_unitOfWork = unitOfWork;
}
Repository (in a different class library):
public interface IBaseRepository<TEntity> where TEntity : class
{}