Repository Pattern is defined by Hieatt and Rob Mee as design pattern that mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects.
Basically it abstracts one or more I/O devices (cloud, disk, data base, etc) into a common collection-like interface where you can read, write, seek and delete data.
However, as pointed out by professor Douglas Schmidt at Coursera course, content provider manages and mediates access to a central repository of data to one or more applications
In the book Programming Android, content providers are used as a Facade for a RESTful Web Service. This approach was initially presented by Virgil Dobjanschi during Google I/O 2010.
Thus, instead of using content providers to access the local SQLite database, why not using it as the repository pattern itself?
Aucun commentaire:
Enregistrer un commentaire