Developing Windows 8 Metro style applications that consume OData

The Source code for the sample app is available here ( Download )

You’ll need :
1. Windows 8 Consumer preview and developer tools
2. OData Client library preview for Windows 8 Metro ( Update: Visual Studio 2012 RC has been released and contains an updated version of these assemblies, along with fully-integrated support for Add Service Reference. Install the Ultimate, Professional, or Premium editions on Windows 8 Release Preview to get the update.) .

We’re releasing a preview version of the client libraries for Windows 8 Metro-Style applications to give our users
the ability to create applications that work on Windows 8 .   This client library will work with servers
that comply with the OData v1-v3 protocols. In the blog post below we will describe a sample application
we built and is available for download using this client library.

Step Zero is to generate the client types for the Netflix OData Service using the DataSvcUtil.exe tool.
We haven’t updated the “Add Service Reference”  gesture in Visual Studio 11 yet, so you’ll have to generate the client
types manually .

Here is how you generate the client proxy types for the Netflix OData Service

Open a command prompt as administrator and navigate to %windir%\Microsoft.NET\Framework\v4.0.30128

Run this command :

DataSvcutil.exe /uri: /DataServiceCollection /Version:2.0

Copy the generated netflixClientTypes.cs file into the application you create in the next step.

Open Visual Studio 11 > “Create new Project” >”Grid Application”



“Genres” view



To build this view, we will add an “Items Page” and customize the Item template to display
details specific to the “Genre” type in the client types such as “Name”.
We further create a custom property called “TileTitle” which is the first title in the genre,
to see how this is implemented, please consult the ODataSampleViewModel.cs file.
When a user selects a “Genre” we will set the “SelectedGenre” property on the view model
and navigate to the “Titles” screen shown below.


“Titles In Genre” view.


To create this view, we will add another “Items Page” and customize the item template to display details specific to the “Title”
type in the generated client types. To load these titles, we track the selected Genre and call the “LoadTitlesForGenre”
method on the view model with the selected genre.
When a user selects a Title, we navigate to the “TitleDetails” view shown below, with the selected title as a navigation parameter.

“Title Details” view :


To create this view, we add a “Basic page” and customize the layout to show the above content
from the selected title which is passed in as a navigation parameter.

Phani Raj,
Software Design Engineer 2,
OData / WCF Data Services

Comments (11)
  1. Phani just published a blog post with directions on how to build OData apps for Windows 8 Metro. The

  2. Jeremy Foster says:

    I did something similar in Windows 8 Metro using JavaScript here:…/Simple-Netflix-Browser-in-Windows-8-JavaScriptndash;Part-1.aspx (Jeremy Foster @codefoster)

  3. Trackback from

  4. In the previous post Running WCF Data Services on Windows 8 Consumer Preview- Part 1 , I described running

  5. Young Oh says:

    Fantastic article and long waited dll files. Thanks.

    I have one issue though. How do we send the credentials to OData service which uses forms authentication?

    I tried,  Context.Credentials = new NetworkCredential(uid, pwd);…

    Otherwise works fine.

  6. I have the same problem as Young Oh. Sending credentials to WCF Data Service using the DataServiceContext.Credentials property doesn't seem to do anything.

  7. Emil Petro says:

    Sorry! Just realized that it is included with the Visual Stuio 2012 RC and we don't have to deal with these stuff anymore.

  8. Pedro Fortes says:

    The OData library seems to be broken with Windows 8 Release Preview and VisualStudio 2012 RC.

    I'm getting this exception:

    System.TypeInitializationException was unhandled by user code


     Message=The type initializer for 'System.Data.Services.Client.TypeSystem' threw an exception.



    Inner Exception:

    {"Could not load type 'System.Reflection.RuntimeExtensions.RuntimeReflectionExtensions' from assembly 'System.Reflection.Extensions, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.":"System.Reflection.RuntimeExtensions.RuntimeReflectionExtensions"}

  9. Please update to the Latest VS RC release to get the OData bits. The download published on this blog is no longer usable with the Windows 8 RC.

  10. is there a simple way to port this demo to Win8 RC?  

  11. octavp_2000,

    its not too difficult to get this sample to work on VS2012 RC and Win8 RC. You essentially need to use the Add Service Reference… functionality and remove the old definitions (i.e. netflixClientTypes.cs). You also have to fix-up some of the Fx changes such ApplicationViewState references and some style references that have changed since this sample was written. I did this in less than 20 minutes 🙂

Comments are closed.

Skip to main content