问题
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