Azure Mobile Service Paging Limitation

左心房为你撑大大i 提交于 2020-01-03 00:00:11

问题


I have a query function that talks to a local Azure mobile service (localhost). I am aware that the default query limitation is 50, and the official document says the Take extension function could be used to extend the limitation up to 1000. But for some reason it does not work for me, no matter how many the Take parameter is, I always got 50 objects back. Am I doing anything wrong?

private async void UpdatePlaceNameList(String type)
    {
        var table = App.MobileService.GetTable<Place>();
        var query = table
            .Where(p => p.Type == type)
            .Take(600)
            .IncludeTotalCount();
        ViewModel["PlaceList"] = await query.ToListAsync();
    }

回答1:


Against the .NET backend there is a server imposed limit of 50 that works a little differently from what the docs say (those apply to the Node.js backend)

The .NET backend returns a default limit 50 records at a time. To override that you need to add a Queryable(MaxTop) to your getAll function in your backend code like so:

Original Answer

[Queryable(MaxTop = 1000)]
public IQueryable<Place> GetAll() 

Update 1: 6/5/2018

The original answer is now marked obsolete, use the following code instead:

[EnableQuery(MaxTop = 1000)]
public IQueryable<Place> GetAll() 

--

This will now let you get up to X records at a time.



来源:https://stackoverflow.com/questions/25678904/azure-mobile-service-paging-limitation

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