Android - Using Dao Pattern with contentProvider

Is correct to use ContentProvider with dao Pattern. ? or it will bring any performance issue ?

I will try to explain. I've a contentProvider. an activity, a dao and a bean ..

this is the code :

class Bean(){

 String name;

}

class Dao{

 Activity activity;

 public Dao(Activity activity){

 this.activity = activity;

public List<Bean> getAllBean() {

    Cursor c = activity.managedQuery(Bean.CONTENT_URI, PROJECTION,
                null, null, Bean.DEFAULT_SORT_ORDER);
    return BeanMapper.GetAllFromCursor(c);
    }
}

}

Class Activity{
.....


 onCreate(....){

  Dao dao = new Dao(this);
  List<Bean> aList = dao.getAllBean();

}
....}

what do you think ?

regards

14
задан Sandip Armal Patil 17 December 2016 в 16:12
поделиться