Регистрирую так
builder.Services.AddScoped(typeof(IGenericRepository < > ), typeof(GenericRepository < > ));
builder.Services.AddScoped(typeof(IGenericService<>), typeof(GenericService<>));
Сваггер выдает
{
"error": "Unable to resolve service for type 'Project_web_api.Service.Implementations.ProjectService' while attempting to activate 'Project_web_api.Presentation.Controllers.ProjectsController'."
}
Сам код сервиса
spoilerpublic class GenericService<TEntity> : IGenericService<TEntity> where TEntity : class
{
private readonly IGenericRepository<TEntity> _repository;
public GenericService(IGenericRepository<TEntity> repository)
{
_repository = repository;
}
public async Task<List<TEntity>> Get()
{
return await _repository.Get();
}