0

I have a Xamarin Forms App that uses Azure Mobile Services offline sync. I want to use a Join to query two tables, but it looks like the use of JOIN isn't supported on IMobileServiceSyncTables. Can I use a regular SQL query? For a single-table query, I'm doing the following:

IEnumerable<Job> jobs = await jobTable
    .Where(job => job.JobPackId == jobPackId)
    .ToEnumerableAsync();

I can join the Job table to the JobPack table on job.JobPackID == JobPack.Id.

My workaround at the moment is to get all the jobs from the above query, then for each job, query the JobPack table for the item I want. But I don't think it's very efficient, so looking for a better way of doing it.

aritchie
  • 601
  • 10
  • 18

1 Answers1

2

Can I use a regular SQL query?

AFAIK, you could not use the join query when using IMobileServiceSyncTables and you could not write your own SQL query. Per my understanding, you are using Azure Mobile Services offline sync, you could not achieve your purpose via a single table query. For querying all records from your Job table and the relevant JobPack record, you need to retrieve your expected records with two queries. Or you could install the SQLite client library and write your own SQL query for join operation. Here is a similar issue. Moreover, you could add your feature request here.

Bruce Chen
  • 18,207
  • 2
  • 21
  • 35