The Open Data Protocol, also known as OData recently has gained a lot of popularity. That is why we decided to demonstrate how to connect and consume an existing OData feed from Telerik Reporting with the help of WCF Data Services. For the sake of this example we will connect to the Northwind sample database exposed as an OData service with the following root URL:
Let's start by adding a service reference to the Northwind data service to our report class library - we use the above service URL for this purpose:
Visual Studio creates a reference to the service in your project and generates automatically a DataServiceContext and an entity model for accessing the exposed data. The DataServiceContext class is called NorthwindEntities by default and defines properties for querying the entities from the Northwind database.
Next we define a query to retrieve some data for the report - for the sake of this example, we should retrieve information about the products by category. To do this add a new class NorthwindDataAccess to the project and define the following method:
var serviceRoot =
var serviceContext =
var productQuery = from product
productQuery = From product
Where product.CategoryName.StartsWith(categoryName) _
Finally create a new report and use the ObjectDataSource component to bind to the NorthwindDataAccess.GetProductsByCategory method as a data source for the report.
As you can see, connecting a Telerik Report to OData feed is straightforward and executed in a seamless manner using the powerful Telerik Reporting's data source components without breaking the best architecture patterns in a few simple steps. The video below shows these short steps in action.
The video is also available in Telerik TV: Connecting Telerik Reports to OData Feeds.
For more information about the OData protocol and WCF Data Services you can visit the following useful links:
Stefan’s main interests outside the .NET domain include rock music, playing the guitar and swimming.