Azure Mobile Service request does not return all rows

I have a table called NameTable in my Azure Mobile Service. When I make the following calls in my client application (WP8 application using the Mobile Services SDK):

var myTable = GetZumoService().GetTable<NameTable>(); var myList = await myTable.Where(nameInfo => nameInfo.IsTaken == false).ToListAsync(); 

myList always contains only 50 elements, although I know that tables contain more than 400 rows matching the query condition.

What am I doing wrong?

+4
source share
2 answers

By default, the service returns only a certain number of lines in each read operation (50, as you noticed). Since there are quotas for the number of bytes returned in Azure services, when they are free (and cost for paid), the mobile service has this default value.

You can request more rows using the Take operation. However, there is a limit on the number of lines that you can set at any given time (which equals 1000). The idea is that you do not have to query all the data in the table β€” this can be a lot β€” and ask for the rows as necessary using the Skip and Take operations.

 var myTable = GetZumoService().GetTable<NameTable>(); var myList = await myTable.Take(500) .Where(nameInfo => nameInfo.IsTaken == false) .ToListAsync(); 
+14
source

I have found that this is not enough. You need to decorate your Azure Mobile Service controller with the [EnableQuery] attribute as follows:

 [EnableQuery(PageSize=1000)] public IQueryable<MyDataTable> GetOneThousandRecords() { return Query() } 
+7
source

All Articles