There is this application, let us call it “Invertory System Api“. this application has a lot of CRUD for database, and it is separated between Services and Repositories, it is using UoW(unit of Work) Pattern in the repositories. The application has Requests, Responses, and DTos
NB: for every Entity they have a model for Create, Update separate and Dto.
Question: Is it a good idea for me to introduce Code Refactoring using Generics in both services and repositories.
Meaning I will be having codes like this :
Service Registration
services.AddScoped<IGenericService<TEntity, TCreate, TUpdate>, EmployeeService>();
In Controllers
private readonly IGenericService<TEntity, TCreate, TUpdate> _employeeService;
So is it a bad or Good Idea for inctroducing Generics here