Azure移动服务PullAsync并非所有数据 [英] Azure Mobile Services PullAsync not all data

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

问题描述

在后端使用Azure移动服务和Azure简易表我想在客户端上获取经过过滤的数据,因为表可能很大,但是对于具有自己ID的特定用户却没有有用的行.我尝试使用

Using Azure Mobile Services and Azure Easy Tables on the back end I want to get filtered data on the client since tables could be quite large but useful rows to specific user with own ID wouldn't be. I tried to use

IMobileServiceTableQuery<Messages> query = 
    msgTable.Where(c => c.UserId==_myId);

await msgTable.PullAsync("syncmsg"+_myid, query);

,但是事实证明PullAsync仅在下一次应用查询,但在第一次提取所有数据.可以使用Azure移动服务以任何方式将其拉并存储在仅根据查询数据过滤的本地存储上吗?

but it turns out that PullAsync apply query only on next times but first time it pulls all data. It there any way using Azure Mobile Services pull and store on local storage only filtered on query data?

推荐答案

因此,首先要做的是-您应该在服务器而不是客户端上进行安全过滤.有多种简便的方法可以根据您的要求调整服务器上的过滤器.参见 https://github.com/Azure/azure-mobile -apps-node/tree/master/samples 获取大量示例.

So, first things first - you should do security filtering on the server, not the client. There are easy ways to adjust the filter on the server for your specifications. See https://github.com/Azure/azure-mobile-apps-node/tree/master/samples for plenty of samples.

关于此问题,您正在构建错误的查询.您想要的是:

As to this issue, you are building the query wrong. The thing you want is:

var query = msgTable.CreateQuery().Where(c => c.UserId == myId);
await msgTable.PullAsync('mysyncquery', query);

注意中间的CreateQuery().否则,您将无法设置基本查询.

Note the CreateQuery() in the middle. Without that, you don't get the base query set up.

这篇关于Azure移动服务PullAsync并非所有数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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