Azure Mobile Services PullAsync not all data

故事扮演 提交于 2019-12-13 18:13:32

问题


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);

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?


回答1:


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);

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



来源:https://stackoverflow.com/questions/43766740/azure-mobile-services-pullasync-not-all-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!