如何使用 Azure Mobile 检索 50 多个项目

How to retrieve more than 50 items using Azure Mobile

我正在使用 Android Studio 并与基于云的 Azure 数据库对话。我知道 50 的查询限制并且想规避这个。我使用这个查询:

private List<ItemInfo> retrieveItemNumList() throws ExecutionException, InterruptedException {
    return mItemInfoTable.select("Item_Number", "Item_Description").execute().get();
}

我已经找到了解决方案,例如:

[Queryable(MaxTop = 1000)]
public IQueryable<Place> GetAll() 

但是,当我使用 Node.js 时,这是一个 .NET 解决方案。另外,我是一个完全的菜鸟,所以我不知道如何访问 Azure 的后端功能。谁能告诉我如何启用 1000 的查询?

谢谢。

今天在 MSDN 论坛上回答了这个问题 - https://social.msdn.microsoft.com/Forums/en-US/5efee2d6-417c-4d48-99d5-b8836d733a3e/override-50-row-limit-for-android-app?forum=azuremobile

@JamieWang,可以使用函数MobileServiceTable.top(int top)来设置记录数为return。

如果没有top功能,根据REST的描述API here,

By default, Mobile Services returns only 50 records in a query.

作为参考,有一个官方教程,您可以参考How to: Query data from a mobile service部分的"How to: Return data in pages"小节来了解如何使用。

所以你的代码应该修改如下。

private List<ItemInfo> retrieveItemNumList() throws ExecutionException, InterruptedException {
    return mItemInfoTable.select("Item_Number", "Item_Description").top(1000).execute().get();
}