Android-CleanArchitecture icon indicating copy to clipboard operation
Android-CleanArchitecture copied to clipboard

Multiple repository

Open BishoyAbd opened this issue 7 years ago • 2 comments

I have some confusion regarding the repository pattern.my question is can I use more than one repository, for example, UserRepository, QuestionRepository, AnotherThingRepository.trying to follow the Single responsibility principle, and then create a Wrapper repository to hold all the repos.

BishoyAbd avatar Mar 23 '18 17:03 BishoyAbd

@BishoyAbd You can create as many repositories as needed for your project... with that said you should create repositories that are specific and not accessing data outside of their domain to stick to the SRP. Like the User repository should not return data that the QuestionRepository should be returning. If that makes sense.

alexwhb avatar Mar 27 '18 18:03 alexwhb

@alexwhb obviously that makes no sense. First of all, the repository pattern used in this project is quite different than what the uncle bob introduced in his work. He used it as Domain model gateway. You are just confused with this project (apparently, old 3 tier architecture remix+) and the bob's clean architecture. For the original question, you may have one repo for one entity if you follow bob's clean Arch...

mishkaowner avatar May 07 '19 15:05 mishkaowner