Description
The single responsibility principle from the SOLID principles, leads to a creating a model for each future of the app. Each ViewModel references to it’s own repository instead of referencing the database directly. This results in cleaner code, and repetitions of the similar code.
Example
We created a simple MVVM example.
Every viewModel creates its own repository, which in its turn has access to the one database.
And the NoteRepository has access to the global used database.
Our MVVM example depicted:
Check this page to view the complete repository.