为什么ArrayList只能为Azure表存储获取50个值?

时间:2015-06-25 05:32:46

标签: android azure-mobile-services

我将产品列表添加到Azure Table Storage,并将产品列表存储在ArrayList中并显示在Tablelayout中..我的问题ArrayList只获得50个值..如何解决这个问题。请帮帮我。

   MobileServiceTable<ProductList> ProductBrand = mClient.getTable("ProductList", ProductList.class);


                        ProductBrand.where().field("enable").eq(val(true)).execute(new TableQueryCallback<ProductList>() {

                            public void onCompleted(List<ProductList> results, int count, Exception error, ServiceFilterResponse response) {

                                final ArrayList<ProductList> list3 = new ArrayList<ProductList>();
                                for (ProductList item : results) {
                                    list3.add(item);

                                }
                                for(int c=0;c<list3.size();c++)
                                    Toast.makeText(getBaseContext(),"Size:"+list3.size()+"Product "+list3.get(c).toString(), Toast.LENGTH_SHORT).show();  }
                        });

1 个答案:

答案 0 :(得分:2)

Azure Mobile Services默认返回50条记录,您可以通过首先将EnableQueryAttribute添加到您的公众&#39; GET&#39;来解决此问题。方法,例如

[EnableQuery(MaxTop(1000)]
public IEnumerable<Product> Get()
{
    ...
}

现在,您可以使用Take方法申请一定数量的产品

MobileServiceTable<ProductList> ProductBrand =                                            
              mClient.getTable("ProductList", ProductList.class).Take(1000);

要避免在服务器上进行任何分页,请使用IncludeTotalCount方法