开发者

Android data access design patterns: Content provider vs repository

I wonder what folks use as a common data access pattern on Android? Content providers? Repositories? DAOs?

开发者_StackOverflowThanks a lot!


I utilize Content Providers for all data access to SQLite resources, but build DAOs on top of them to handle all domain object conversions.


I always create Repository interface and use it in my domain model. Then I have concrete implementation of Repository with raw SQLite, OrmLite, Real etc. I this case it is easy to test your domain model with Unit tests because your read database or android specific components are encapsulated.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜