Recently, as soon as the release of Visual Studio 2013 was made, new improvements of ASP.NET Web API 2 and ASP.NET MVC 5 were presented too. New enhancements of Web API include some features for OData that weren’t present in the first release of the ASP.NET Web API Data in June 2013. Now there are for OData capabilities which are integral part of the Web API: operators $select, $expand and $value and batch updates.
What lies in the basis of improvements?
OData – it is an open standard specification. It is developed for CRUD-centric (Create – Read – Update – Delete) data services concerned along with HTTP. The OData counts with almost all design guidelines of the REST architectural style. It provides easy implementation of data services with performing on various modern development platforms.
These tasks are performed using two main OData features. The first, OData URL query syntax is meant for rich queries from clients with sorting, filtering and paging. The second, full OData communication protocol, contains OData message formatting standards, supported operations and calling patterns which are performed for CRUD operations using OData.
Web API OData supports OData services for ASP.NET Web API. Such services provide the OData query syntax that suits to all Web API services. In such a case IQuerable collection results are demonstrated by GET operations. One more pleasant improvement – is OData protocol compliant service. It supports full CRUD operations which are used on an object model that means relationships between the entities.
These changes in the Web API 2 is a good news for ASP.NET developers
Developers will certainly be pleased by the fact that new OData capabilities implementation doesn’t need making changes in the code on the condition that the application has been used since the release of Web API in June 2012. It means that new OData capabilities can be run, if users add the ASP.NET Web API 3 Odata NuGet package. Speaking of the batch operation, simple changes in the routing initialization are need to enable performance of the capabilities.
Thanks to NuGet packages all enhancements are compatible to .NET 4.0. The operators $select and $expand start to work just as the NuGet is installed. You don’t have to insert changes in your code. To get a single property you just run an accessor method for chosen property to the controller. It includes entity key and naming convention of Get<ProperyName>(). Finally, dispatching calls will be performed by the OData routing.
Author: technology consulting company Coherent Solutions