开发者

Android data access design patterns: Content provider vs repository

开发者 https://www.devze.com 2023-02-18 03:26 出处:网络
I wonder what folks use as a common data access pattern on Android? Content providers? Repositories? DAOs?

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

精彩评论

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

关注公众号