zhengbli
zhengbli

Reputation: 712

Azure Mobile Service Paging Limitation

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

Upvotes: 1

Views: 1270

Answers (1)

phillipv
phillipv

Reputation: 1717

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.

Upvotes: 8

Related Questions