I've been reading about the repository pattern and how to implement it correctly.
There is one important issue that I'm confused about.
Say we have a generic repository with basic operations like Add(), Remove(), GetById(), etc. and we also have a specific repository per entity (e.g. ProductRepository, UserRepository, etc.)
Should we define entity-related operations in the specific repositories or not? For example, in the ProductRepository, should I declare methods like GetProductsInCategory(), GetProductsByBrandId(), etc. or is this the responsibility of the service layer?
There is a lot of information out there that are against each other, as an example, this answer claims that the answer to the question that I just asked is No, but on the other hand in this tutorial video (which has a lot of views) the instructor claims that the answer to my question is Yes.
I'm really confused about the actual methods and operations that we have to implement in a repository.
Aucun commentaire:
Enregistrer un commentaire