InformationWeek

7_23_Dr_Dobbs

Issue link: http://dc.ubm-us.com/i/350594

Contents of this Issue

Navigation

Page 8 of 26

August 2014 9 www.drdobbs.com Using OData from ASP.NET Take advantage of your knowledge of both ASP.NET MVC and the ASP.NET Web API to easily create OData endpoints. O Data (Open Data Protocol) is a standardized protocol for creating and consuming data APIs through regular HTTP requests and REST. It is the "ODBC of the Web" and provides a standard solution for very common Web API patterns. For example, OData (http://www.odata.org/) includes support for queries, paging, and batching, among many other typical requirements. Creating an OData Endpoint Microsoft ASP.NET Web API OData adds most of the necessary things to create OData endpoints and easily provide OData query syntax using the ASP.NET Web API (initially introduced in .NET Framework 4.5). ASP.NET Web API 2.2 added many improvements that make it easier to work with OData, including support for OData 4.0. In this article, I provide an example that uses the features pro- vided in Microsoft ASP.NET Web API 2.2 OData. ASP.NET Web API 2 was included in Visual Studio 2013 and pro- vided support for OData 3.0. The recently launched ASP.NET Web API 2.2 added support for the newest version of the standardized protocol: OData 4.0. In addition, the newest ASP.NET Web API ver- sion includes many interesting improvements related to OData, such as attribute routing, model aliasing, support for Enums, ETags, the $format query option, and the ability to specify which prop- erties can be sorted, expanded, filtered, or navigated. I want to work with ASP.NET Web API 2.2 in Visual Studio 2013, so I have to run a few NuGet Package Manager Console com- mands. I'll explain the steps to create a project that generates an OData endpoint and allows you to run OData queries on a sim- ple Games entity with support provided by Entity Framework, but you don't have to use Entity Framework to take advantage of ASP.NET Web API OData. You can use a similar structure with other data sources. Create a new ASP.NET Web Application project in Visual Studio 2013. I'll use Games for both the project and solution names. By Gaston Hillar [ ODATA ] Table of Contents @GastonHillar Previous Next Previous Next Download Download Register Register Subscribe Subscribe Previous Next Previous Next

Articles in this issue

Links on this page

view archives of InformationWeek - 7_23_Dr_Dobbs