2
votes

I'm using a javascript-based Azure Mobile Service, so no Web API / Entity Framework / Code First. I'm just using the Azure portal to create the tables and columns. I've noticed that there's no way to define strong relationships between tables. I have created columns that reference other columns. But unlike Entity Framework, this does not create true foreign key relationships between tables.

I've read that one can use the $expand ODATA operator to return related data: http://zimmergren.net/technical/extending-windows-azure-mobile-services-queries-to-include-relational-data-and-optional-metadata

...but the MSDN documentation for the Azure Mobile REST API does not contain the $expand operator: https://msdn.microsoft.com/en-us/library/azure/jj677199.aspx

Does this mean that relational queries are not possible without using an Entity Framework based Azure Mobile Service? Is the $expand operator only available for .NET-based Azure Mobile Services (not javascript-based)?

1

1 Answers

2
votes

The $expand query operator is not supported in the Node.js backend for Mobile Services. However, you could certainly modify your Read backend scripts to return data from the related tables.

See this document for more information on implementing joins in your backend code: https://azure.microsoft.com/en-us/documentation/articles/mobile-services-how-to-use-server-scripts/#joins

You should also make sure you optimize your SQL queries: https://azure.microsoft.com/en-us/documentation/articles/mobile-services-sql-scale-guidance/