【问题标题】:Azure mobile services PullAsync(query) not filtering recordsAzure 移动服务 PullAsync(查询)不过滤记录
【发布时间】:2014-11-25 06:09:42
【问题描述】:

我是 windows phone 和 azure 移动服务的新手。我想在我的应用程序中使用 azure 离线数据,但 PullAsync() 有一个问题。我不想将所有数据拉到本地数据库。我要过滤数据。

我尝试像这样使用 PullAsync():

await App.rateTable.PullAsync(App.rateTable.Where(a => a.user_id == userId));

它不起作用,我收到错误的请求消息。

user_id 不是主键。 在将所有数据拉到本地数据库之前,有什么方法可以过滤数据吗?

【问题讨论】:

  • 这应该可以工作,上面的代码应该向服务器发送一个查询,例如:/table/rate/$filter=(user_id eq '')。我将首先使用邮递员之类的工具来验证上面显示的查询是否可以在服务器上运行。如果是这样,请验证您的 user_id 属性和您的 userId 变量的类型是否正确并与服务器的预期匹配。

标签: azure windows-phone-8 azure-mobile-services


【解决方案1】:

更多信息请访问this msdn forum thread

以下将第一次检索所有记录,之后只检索更新记录:

await App.rateTable.PullAsync("userId", 
                               App.rateTable.Where(a => a.user_id == userId));

第一个参数是queryKey。这用于跟踪您对服务器的请求。请注意,queryKey 限制为 25 个字母数字字符,并且不包括连字符、空格等。来自链接线程:the query key should just be a descriptor of the query

猜你喜欢
  • 2015-12-17
  • 2017-10-01
  • 1970-01-01
  • 1970-01-01
  • 2013-01-29
  • 1970-01-01
  • 2014-10-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多