I’ve been doing a lot of work with Windows Azure Mobile Services (WAMS). It’s a brilliant technology that allows you to stand up powerful OData compliant services to support your Windows 8 Store Apps, Windows Phone 8 Apps, and even iOS apps in just a few minutes. It’s hard to oversell the sheer awesomeness of this stuff.
I’m currently working on a bunch of code that will shortly become a sample project highlighting both WAMS and Windows 8 Apps (look for a project called “FamilyPig” coming soon). In the process of building that, I ran into a couple of questions – one of which I’ll cover here, and give some guidance to people who might be running into a similar question.
One of the cool features that makes WAMS super easy to work with is the concept of “dynamic schema”. In a nutshell, that means that if you have an existing table, and you throw a Plain Old CLR Object (POCO) at it using the InsertAsync method (of the IMobileServiceTable interface), WAMS is smart enough to look at the object coming in, and make sure that it has all the columns that it needs in the underlying Windows Azure SQL Database table to store the record (assuming that “dynamic schema” is enabled on the mobile service). If the column does exist, it gets created on the fly. Very, very cool. Note, what’s actually happening under the covers is that your POCO object is being converted to a JSON object for transmission over the wire, and WAMS is pulling apart that JSON object to look at the columns.