Azure 移动服务查询未返回所有行 [英] Azure Mobile Service query doesn't return all the rows

查看:23
本文介绍了Azure 移动服务查询未返回所有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 Azure 移动服务中有一个名为 NameTable 的表.当我在我的客户端应用程序(使用移动服务 SDK 的 WP8 应用程序)中进行下面提到的调用时:

I have a table called NameTable in my Azure Mobile Service. When I make the below mentioned calls in my client app (WP8 app using the Mobile Services SDK):

var myTable = GetZumoService().GetTable<NameTable>();
var myList = await myTable.Where(nameInfo => nameInfo.IsTaken == false).ToListAsync();

myList 总是只包含 50 个项目,尽管我知道表中有 400 多行符合查询条件.

myList always contains only 50 items although I know that there are more than 400 rows in the tables that match the query condition.

我做错了什么?

推荐答案

默认情况下,服务将在每个读取操作中仅返回一定数量的行(如您所见,为 50).由于 Azure 服务在免费时(以及付费服务的成本)中的返回字节数有配额,因此移动服务具有此默认值.

By default the service will only return a certain number of rows in each Read operation (50, as you noticed). Since there are quotas for the number of returned bytes in Azure services when they're free (and costs for paid ones), the mobile service has this default.

您可以使用 Take 操作请求更多行.但是,在任何给定时间可以询问的行数是有限制的(即 1000).这个想法是你不应该要求表中的所有数据 - 它可能有很多 - 并根据需要使用 SkipTake 要求行操作.

You can ask for more rows, using the Take operation. There is, however, a limit on the number of rows which you can ask at any given time (which is 1000). The idea is that you shouldn't ask for all data in a table - it can potentially be a lot - and ask for rows as you need them using the Skip and Take operations.

var myTable = GetZumoService().GetTable<NameTable>();
var myList = await myTable.Take(500)
                          .Where(nameInfo => nameInfo.IsTaken == false)
                          .ToListAsync();

这篇关于Azure 移动服务查询未返回所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆