News

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."

The OData.org 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.

.NET 5
[Click on image for larger view.] .NET 5 (source: Microsoft).

"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

http://localhost:5001/odata/Books(2) 

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 at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube