…in the Windows Phone SDK 7.1
The OData team has made many significant improvements to the client library for Windows Phone 7.5 (formerly code-named “Mango”), which now ships in the Windows Phone SDK 7.1. Frankly, there is so much awesome new functionality in this release that I couldn’t get all the OData improvement details into the “official” What’s New in the Windows Phone SDK topic. I wanted to publish at least an official looking list of everything to enable folks to find what they need.
OData Client Library now ships in the Windows Phone SDK
It may not seem like a big deal that the OData client library is in the SDK, but consider that the previous version of the library was published as a separate download on CodePlex. Not the ideal user experience for one of the primary data access technologies for Windows Phone.
Add Service Reference Integration in Visual Studio
You can now use the Add Service Reference dialog to add a reference to an OData service, like you can when building client applications for .NET Framework and Silverlight. As you would expect, this tool adds the correct assembly references and generates all the client data classes needed to access the referenced OData service. For more information, see the section Generating Client Proxy Classes in the OData client library documentation.
LINQ Query Support
Windows Phone now includes support for Language Integrated Query (LINQ) queries. This removes the previous restriction of having to use only URI-based queries against the data service. Now, you can compose queries against an entity set (OData feed) by simply constructing a DataServiceQuery<T> or by accessing one from a strongly-typed DataServiceContext. For more information, see the section Querying Resources in the OData client library documentation.
Improved DataServiceState Functionality
In the DataServiceState object, existing methods are replaced with new ones named Serialize and Deserialize. These methods serialized data service state to and restore state from a string, respectively. Because these methods serialized to and from a string representation, you can more predictably store the state of objects and relationships tracked by the DataServiceContext in the application state when tombstoning. Serialization of nested binding collections is also now supported. For more information see the section Maintaining State during Application Execution in the OData client library documentation.
You can now use the Credentials property to specify the authentication credentials that the DataServiceContext uses when sending requests to the data service. Before this, you had to manually set the Authentication header in the request. For more information see the section Client Authentication in the OData client library documentation.
The client library has added the extensibility to be able to implement message compression when communicating with a data service. Because Silverlight does not have a native compression provider, you must use a third-party compression provider that is supported on Windows Phone. For more information see the section Message Compression in the OData client library documentation.
The existing Windows Phone and OData quickstart Consuming a Windows Azure Data Service by using the OData Client on AppHub has been updated for the Mango release, and the source projects (in both C# and Visual Basic) are available from the page Consuming a Windows Azure Data Service with the OData Client for Windows Phone in the MSDN Samples Gallery.