Consuming Live OData feed in Silverlight WCF RIA Services hosted on Windows Azure, Windows Phone 8 & Windows Store app

Windows Azure supports Silverlight Business Applications(WCF RIA Services) as web role application. In order to work with WCF RIA services , enterprise business apps have rich support with OData endpoints, WCF Data Services, WCF Domain services(ADO.NET Entity Frameworks) , LINQ to SQL in order to connect with backend on-premise SQL Server or SQL Azure database. So, in current article, implemented a simple Silverlight enterprise business app running on Windows azure executing via live WCF OData endpoints while the same service can be consumed on Windows Phone 8 & Windows Store app without changing any major coding implementations.

Lets check the application architecture first which consists of a Windows Azure app running on dev fabric , Silverlight WCF RIA service app, Windows Phone 8 app & Windows Store app developed in VS 2012 ultimate platform.


  • Next , lets check about the architecture viewpoint of the Silverlight Business app running on Windows Azure. For consuming live OData feed , we have used the MSTeched 2010 Live feed which can be accessed @
  • Consume the OData feed as Service Reference & configure with LINQ query to specify the modules from the feed.

LINQ Query Sample:


from  g in Speakers


g.SpeakerID > 1620



select  g



  • Lets check the Silverlight client to consume the OData feed with asynchronous task library.

var ctx = newODataTENA10Entities(newUri(”, UriKind.Absolute));

var qry = from g in ctx.Speakers

where g.SpeakerID > 1620

orderby g.SpeakerFirstName

select g;

var coll = newDataServiceCollection<Speaker>();

coll.LoadCompleted += newEventHandler<LoadCompletedEventArgs>(coll_LoadCompleted);


DataContext = coll;

  • Lets check the silverlight web business app consuming live OData feed using WCF Data services & LINQ displaying MS Tech 2010 speakers list.



  • Similarly migrate the Silverlight Business app into Windows Azure platform & host as web role application.
  • OData feed can be consumed to any standard windows client like Windows Phone, Sharepoint , Windows Store, Azure Appfabric Service Bus.
  • Next, Lets add a new Windows Phone 8 Panorama application with our existing solution & add few code to consume the live OData feed & add service reference to work with WCF data services. For VS 2010, Windows Phone 7.1/ Windows Phone 8 apps, we need to work withSystem.Data.Services.Client.dll which can be obtained from here .
  • Add the following code to MainPage.xaml.cs in order to consume the live service from OData endpoint to Windows Phone.


private void MainPage_Loaded(object sender, RoutedEventArgs e)


var ctx = newODataTENA10Entities(newUri(;));

var coll = newDataServiceCollection<Speaker>(ctx);

lst.ItemsSource = coll;

coll.LoadCompleted += new  EventHandler<LoadCompletedEventArgs>(coll_LoadCompleted);

    var qry = “/Speakers”;

coll.LoadAsync(new Uri(qry, UriKind.Relative));


void coll_LoadCompleted(object sender, LoadCompletedEventArgs e)


if (e.Error != null)






  • Lets add one more project to consume the live OData feed on Windows Store Metro Style app to display Teched 2010 speakers list.
  • Since , Windows Phone 8 & Windows Store shares the same kernel structure , so same code can be applied for Windows Phone 8 & Windows Store apps developed as per as developed same class library, same UI structure & same architecture pattern (MVVM Model).
  • In Windows Store apps, the same code for Windows Phone 8 app can be applied in order to get live OData services feed on surface.
  • The OData Client library for Windows Store app can be downloaded from here


%d bloggers like this: