Writing...Data Services

Coding and writing about OData and now Windows Azure Mobile Services...

OData Quickstart for Windows Phone Updated—Now with VB!

OData Quickstart for Windows Phone Updated—Now with VB!

  • Comments 1

I’m not sure if I’ve mentioned it here on my blog yet or not, but the forthcoming release of Windows Phone 7.5 (“Mango”) and the Windows Phone SDK 7.1 features huge improvements for consuming OData feeds. This means that, in Mango, OData support on phone is basically equivalent to Silverlight 4 and .NET Framework 4 (asynchronous only).

Here’s a list of what has gotten (much) better (for a complete list, see my next post):

  • Add Service Reference—it works now! No more having to use DataSvcUtil.exe now (in most cases) and manually add your references. This is sure a welcome sight when writing a Windows Phone app:
    image
  • LINQ is back!—they (finally) added LINQ support to phone, so welcome back to DataServiceQuery<T> and the ease of composing queries against entity sets returned by a strongly-typed DataServiceContext. Now, no more having to manually compose URIs for queries, check it out:
    image
  • DataServiceState* works much better—if you ever tried to use the Save and Restore methods on the old DataServiceState object, they weren’t really ready for prime time. The new DataServiceState object has methods that are explicitly named Serialize and Deserialize, which do just what they say. Serialize returns you a true string-based serialization of everything being tracked by the context, and Deserialize now returns a correctly re-hydrated context, including nested collections.
  • Authenticated requests—new support for attaching credentials to the DataServiceContext using the Credentials property (like you can do in Silverlight 4). The client uses these credentials to set the Authentication header in the request. Before this, you had to set this header yourself.
  • Compression* works—well, technically it now CAN work, but there is no “in the box” support and you need to track down your own compression provider. However, this cool because I wasted an entire day trying to make compression work in WP7—totally blocked. For more info on how to make this work see this topic (until I can get something published).
  • Now, available in your SDK!—the previous version of the library was published as a separate download. Now, the OData library is a first-class citizen and in the Windows Phone SDK 7.1.
    * This denotes a Windows Phone-only OData functionality.

To better highlight these most excellent OData improvements in Mango, I am in the process of getting the “official” OData on Windows Phone quickstart updated for the pending release. While I wait for these updates to go live, I went ahead (to help out the folks rushing to write Mango-based apps) and updated the existing sample project to the new version, which you can find here:

Attention Visual Basic programmers!
Please notice that there is now also a VB version of this sample published (for a total of like 4-VB samples for phone). I am definitely not primarily a VB guy, but I am proud to say that I DID NOT use a converter to create this VB app. So, if you find code in there that looks like it was definitely written by a C# guy or is bad, please leave me a note on the sample project’s Q and A page.

As you will see, this update to Windows Phone and the SDK makes writing OData apps for phone tremendously more fun.

Code on!

Glenn Gailey

Leave a Comment
  • Please add 3 and 2 and type the answer here:
  • Post
  • Hi Glenn,

    Nice stuff. I call myself a VB guy and your code meets my standards (FWTW).

    Thanks for the extra effort to get a VB version out.

    bill b (ProfB - myVBProf.com)

Page 1 of 1 (1 items)