Microsoft Engineer: 'It's Time to Move OData to .NET 5'
Microsoft engineer Sam Xu says "it’s time to move OData to .NET 5" and in a new blog post he shows how to do just that.
Xu, a senior software engineer for OData and a few other properties, provided guidance on how to move the BookStore sample that was used in the July 2018 introduction of OData in ASP.NET Core 2.0.
OData, short for Open Data Protocol, was introduced by Microsoft in 2007 and subsequently became an OASIS standard that "enables the creation and consumption of REST APIs, which allow Web clients to publish and edit resources, identified using URLs and defined in a data model, using simple HTTP messages."
site says "OData helps you focus on your business logic while building RESTful APIs without having to worry about the various approaches to define request and response headers, status codes, HTTP methods, URL conventions, media types, payload formats, query options, etc. OData also provides guidance for tracking changes, defining functions/actions for reusable procedures, and sending asynchronous/batch requests."
Having been part of ASP.NET Core for nearly two years now, OData will also be part of the upcoming (November 2020) release of .NET 5, a unification of all things .NET into one platform that can be used to target Windows, Linux, macOS, iOS, Android, tvOS, watchOS and WebAssembly and more. The second preview of .NET 5 shipped last week.
"We encourage you to download the latest ASP.NET Core OData package from Nuget.org and start building amazing OData service running on any .NET 5 platforms, such as Windows, MacOS and Linux," Xu said in an April 6 blog post.
In that post, Xu explains in detail how to move the ASP.NET Core Bookstore project to .NET 5. The process involves tweaking the BookStore.csproj and Startup.cs files -- after installing the .NET 5 SDK and Visual Studio 2019 v16.6 Preview.
Those tweaks allow for simple GET requests such as
to retrieve the second book from a list, along with advanced queries such as
http://localhost:5001/odata/Books?$filter=Price le 50&$expand=Press($select=Name)&$select=ISBN,Location($select=Street)
Xu's resulting project -- BookStoreDotNet5 -- is now available on GitHub.
And that's not the only development work that Microsoft has been doing around OData, as it recently announced the release of OData Connected Service 0.7.1.
Available as a Visual Studio extension in the IDE's marketplace, OData Connected Service is described as a tool used to generate code to facilitate consumption of OData services by creating a DataServiceContext and classes for the entity types and complex types found in the service description.
About the Author
David Ramel is an editor and writer for Converge360.