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 for Converge360.

comments powered by Disqus

Featured

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

  • What's New for Python, Java in Visual Studio Code

    Microsoft announced March 2024 updates to its Python and Java extensions for Visual Studio Code, the open source-based, cross-platform code editor that has repeatedly been named the No. 1 tool in major development surveys.

Subscribe on YouTube