OData
Create and consume RESTful APIs in a simple and standard way
Latest posts
Announcing ASP.NET Core OData 10.0.0 Preview 1
We're thrilled to announce the release of ASP.NET Core OData 10.0.0 Preview 1, a major modernization update that embraces .NET's native and types! This release upgrades to .NET 10.0 and replaces OData's proprietary and CLR wrapper types with .NET's native structs. What's Changed Framework & Dependency Updates .NET 10.0 Support ASP.NET Core OData now targets .NET 10.0, taking advantage of the latest runtime performance improvements and language features. OData Library 9.x and Model Builder 3.x Integration This release updates OData dependencies to align with the latest OData .NET ecosystem: ...
Announcing OData Model Builder 3.0.0 Preview 1 Release
We're excited to announce that OData Model Builder 3.0.0 Preview 1 has been officially released and is available on NuGet: This is a major release that brings the library up to date with the latest .NET and OData ecosystem, featuring .NET 10 support, OData Library 9.x compatibility, and modernized date/time handling using native .NET types. What's New in OData Model Builder 3.0.0 Preview 1 Framework & Dependency Updates .NET 10 Support OData Model Builder now targets .NET 10, aligning with the latest .NET runtime and taking advantage of modern performance improvements and language features. The l...
Announcing OData .NET (ODL) 9 Preview 3 Release
We’re happy to announce that OData .NET (ODL) 9 Preview 3 has been officially released and is available on NuGet: What’s New in OData .NET (ODL) 9 Preview 3 The OData .NET (ODL) 9.0.0 Preview 3 introduces a set of important changes and cleanup efforts to modernize the library, align with .NET’s evolving runtime, and simplify the OData developer experience. Below, we’ll go through the notable changes included in this release. Use for Action Queries Returning a Single Item Summary We updated to avoid throwing an exception when an action returns no result. The and methods now choose ...
Announcing a new OData.NET serializer
One of the major, recurring complaints of the OData.NET libraries is the performance overhead of the serialization stack. We have done a lot of work to improve the serialization performance, but the existing architecture limits how far we can go. For this reason, we have started work on a new serialization stack for OData.NET libraries that addresses major performance concerns and also makes general improvements to usability. We plan to ship this new serializer as part of 9.x library (the next major release) under a new namespace as an alternative to the existing and . But you don't have to wait for 9.x rel...
Enable OData functionalities on ASP.NET Core Minimal API
Introduction Minimal API is a simplified approach for building HTTP APIs fast within ASP.NET Core, compared to the controller-based APIs. Developers can build fully functioning REST endpoints with minimal code and configuration, especially without controller, action and even the formatters. See ASP.NET Core Minimal API details at here. Since Microsoft.AspNetCore.OData version 9.4.0, it enables developers to achieve OData functionalities on ASP.NET Core minimal APIs. In this post, I’d like to go through the basics of enabling OData functionalities on a Minimal API application. Let’s get started. Prerequisites...
OData .NET (ODL) 9 Preview Release
We’re happy to announce that OData .NET (ODL) 9 Preview 2 has been officially released and is available on NuGet: What’s New in OData .NET (ODL) 9 Preview 1 & 2 The OData .NET (ODL) 9.0 previews introduce a set of important changes and cleanup efforts to modernize the library, align with .NET’s evolving runtime, and simplify the OData developer experience. Below, we’ll go through the notable changes included in the first two preview releases. Targeting .NET 10 Preview ODL now builds against .NET 10 preview, ensuring compatibility with the upcoming runtime. This helps early adopte...
ASP.NET Core OData Web API Template Preview Release
We are excited to announce the public preview release of the ASP.NET Core OData Web API Template Pack. This template helps you create an ASP.NET Core Web API project with OData support, providing a streamlined setup for .NET 8.0 and above. The following preview release is now available on NuGet: Key Features Installation To install the template, use the following command: Usage Using dotnet CLI Create a new project using the template: Using Visual Studio IDE Select Create to create the new project...
Announcing ASP.NET Core OData 9 Official Release
We're happy to announce that ASP.NET Core OData 9 has been officially released and is available on NuGet: The major highlight of this release is the update of the OData .NET dependencies to the 8.x major version. By updating the dependencies, we're able to take advantage of the improvements and new capabilities introduced in Microsoft.OData.Core 8.x and Microsoft.OData.Edm 8.x releases specifically. The ASP.NET Core OData 9 release will only support .NET 8 or later. The OData .NET 8 official release announcement addresses the major changes introduced in that release. It's advisable to go through t...
Announcing OData .NET 8 Official Release
We're happy to announce that OData .NET 8 has been officially released and is available on NuGet: We would like to thank the community for trying out the pre-release versions and sharing feedback with us following our announcements of the previews and release candidates. This release presents an opportunity for us to modernize our stack, address some technical debt and take better advantage of investments in .NET. OData .NET 8.0.0 contains changes to improve maintainability, user experience, performance and add new capabilities.To make adoption and upgrading to the new version smooth, we hav...
Announcing OData .NET 8 Release Candidate 1
OData .NET 8.0 RC1 is now available, bringing numerous significant improvements to the following libraries: This is the final release candidate before the official launch of these libraries, scheduled for August 12th. Most of the planned features and changes are included in this release candidate and are ready for you to explore. In addition to the changes listed in these documents: This release includes the following updates: Some of these updates are breaking changes. Updates in Version 8.0.0-rc.1 We invite you ...
Microsoft.AspNetCore.OData 9 Preview Release
We are excited to announce the forthcoming major release of Microsoft.AspNetCore.OData, scheduled for June. In preparation for this significant update, we have made preview versions of the library available to gather early feedback from our community. The following preview release is now available on NuGet: Key Update The primary change in this release is the update of the OData core libraries dependencies to the recently released OData Core 8.0.0-preview versions. To review the breaking changes and updates made in the OData Core libraries, which we have incorporated into this release, please check t...
OData .NET 8 Preview Release
We would like to announce that we are planning a new major release of OData .NET core libraries in June. Ahead of this release, we have released preview versions of the libraries to get some early feedback from the community. Specifically, the following preview releases are now available on NuGet: It has been almost 8 years since the last major release of OData .NET core libraries. This release presents an opportunity for us to modernize our stack, address some technical debt and take better advantage of investments in .NET. To make adoption and upgrading to the new version smooth, we have op...
Deep insert support in OData client
In the Deep insert support in OData webapi blog post, we demonstrated how to add deep insert capabilities to an OData service. In this blog post, we demonstrate how to add deep insert capabilities in OData client. In the following sections, we implement a client app. Create a Console application Install required packages In our client application, we are going to use the library that offers APIs for building deep insert requests and consuming deep insert responses. Run the following command on the Visual Studio Package Manager Console to install the nuget package...
Working with media resources in OData – Part 2
In Part 1 of this blog post, we demonstrated how to implement an OData service that serves media resources. In Part 2, we look at how to implement a client app that interacts with the OData binary large object (BLOB) feed to both retrieve and post binary data along with the metadata for the media resource. The OData BLOB feed created in Part 1 supported the following functionality: The service also exposed a single media link entry (MLE) named that is linked to a media resource (MR). In the following sections, we implement a client app to interact with that BLOB feed. Create a Con...
Working with media resources in OData – Part 1
OData enables you to define data feeds that serve binary large object (BLOB) data. In OData lingo, this binary data is referred to as a media resource. A media resource (MR) is an unstructured piece of data or stream, e.g., a document, image, or video. It is requested from the data service separately from the entry in the feed to which it belongs, called a media link entry. A media link entry (MLE) is a special type of entry which links to an MR and includes additional metadata about it. Typical metadata that an MLE may maintain about the related MR include description, file name, file size, dimensions, date uplo...
Enable Un-typed within ASP.NET Core OData
Introduction The latest ASP.NET Core OData supports the following two built-in OData abstract types: Developers can use them to advertise a property in OData metadata schema (aka, Edm model) so that such property is declared with a particular name present, but there is no type associated to describe the structure of the property's values. Here's an example: Where, Data is called single value untyped property, meanwhile Infos is called collection value untyped property. Since they are untyped, in other words, there's no type limitation for the property value, developers can use any kind of val...
Deep insert support in OData Web API
Background In , we added support for deep insert. In deep insert, we create an object and its related items or link existing items in a single request. This blog post is a continuation of Bulk Operations Support in OData Web API. In that blog post, we explained how to use and classes. We will not repeat that in this blog post. Bulk update and deep insert share the same and classes. In the following sections, we will cover how deep insert is implemented in and the things that the developer needs to do to use it in their OData service. Controller For the controller action to handle deep insert, the...
Enable CBOR within ASP.NET Core OData
Introduction CBOR, which stands for Concise Binary Object Representation, is a data format whose design goals include the possibility of extremely small code size, small message size, and extensibility without the need for version negotiation (from cbor.io). CBOR is based on the wildly successful JSON (aka, JavaScript Object Notation) data model, and is a binary data representation of JSON. Here's an example of a simple JSON value in plain text and binary representation. OData library, by default, uses the plain text JSON representation for OData requests and response data serialization (writing) and dese...
Customize OData payload serialization format within ASP.NET Core OData
Introduction JSON (aka, JavaScript Object Notation), a standard text-based format for representing structured data based on JavaScript object syntax, is the default representation for the OData requests and responses payload, see OData JSON format here. It’s a very popular format and widely used in most scenarios. However, there are customers who want to build services following OData conventions and want to get OData payload using formats other than JSON, such as CSV (aka, Comma Separated Value) format, or YAML (aka, YAML Ain't Markup Language) format, etc. OData .NET libraries are designed to empower custom...
Bulk Operations Support in OData Web API
Good news! OData Web API 7.x now supports bulk operations. Install the most recent version of OData Web API 7.x(v7.6.3) to take advantage of bulk operations. A bulk operation is one that allows you to perform multiple operations (insert, update, delete) on multiple resources (of the same type) and their nested resources (to any level) with a single request. A bulk operation can either be: Deep Update A deep update is a patch request. The following is an example of a deep update request: How the above request will be processed: NOTE: The @odata.context annot...
Extension: Omit null value properties in ASP.NET Core OData
Introduction By default, ASP.NET Core OData serializes a single value property as “null”, and a collection value property as an empty array if its value is null as such: It’s good for most scenarios. However, omitting those 'annoying' null-value properties from the OData response gets more and more attention. Along with the latest ASP.NET Core OData, it’s very easy to omit such null-value properties by extending the OData resource serializer. The approach is so common that it’s better to create a post and value more customers/developers. Let’s get started. Prerequisites As usual, my post starts with buildin...
Using the new JSON writer in OData
version 7.12.2 has introduced a new JSON writer that’s based on .NET’s Utf8JsonWriter. The current JSON writer used in , internally called , is a custom implementation that uses to write the JSON output to the destination stream. We decided to write a new implementation to take advantage of the performance optimizations in . In order not to disrupt existing customers, people will have to explicitly “opt-in” to using the new writer. Currently, allows you to override the default used for writing JSON output by providing a custom to the dependency-injection container that’s attached to the message instance (...
Tutorial: Build gRPC & OData in ASP.NET Core
Introduction gRPC (google Remote Procedure Call) is a high-performance remote procedure call framework that helps developers to build and consume remote services using the same way as calling local APIs. Different from gRPC, OData (Open Data Protocol) is an OASIS standard that defines a set of best practices for developers to build and consume RESTful APIs using HTTP request/response. Both approaches have their own strong points, for example, gRPC has less network usage with protobuf binary serialization, on the contrary, OData uses JSON as data format for human readability. In addition, OData has powerful query...
Customizing $filter for spatial data in ASP.NET Core OData 8
Background The OData URI parser parses the $filter query to a FilterClause. The translates an OData parse tree represented by a FilterClause to an Expression. The can be applied to an and passed to an ORM (e.g Entity Framework Core) for processing. The contains the default implementation on how the Expressions should be created. This creates a few issues: In this blog post, we will demonstrate how to implement support for the OData spatial built-in function. The current ASP.NET Core OData 8 doesn't support it. EF Core enables mapping to spatial data types in the database by using typ...
$compute and $search in ASP.NET Core OData 8
Introduction OData system query options, such as $filter, $orderby, are a set of query string parameters that control the amount and order of the data returned for the resource identified by the URL. In the latest version of ASP.NET Core OData, two new system query options as follows are enabled: Along with other query options, $compute or $search requests the service to perform a set of transformations at the server side to control the returned data. In this post, I will use a simple product-sale OData service to go through the $compute and $search scenarios and share ideas of how to use $compute a...
The Future of OData NxT (Neo)
Few months ago I announced a collaboration with the OData team to start building a new version of OData that can withstand the forever changing requirements in software design and architecture. I got together with Sam Xu and we decided to kick-off a spin-off version of OData.NET that I called OData NxT (Neo) OData Neo is an attempt to reconceptualize the core capabilities of OData while maintaining the original syntax protocols published by Microsoft back in 2007. The new Implementation will fulfill the following priorities: This is OData Neo. The next generation of OData Protocol implementation for the .NET ...
Adding support for $count segment in $filter collections in OData WebAPI
Introduction In OData core v7.9.0 we added improved support for $count segment in $filter collection properties. Previously, versions of OData core had support for: We are constantly improving filtering capabilities in OData WebAPI. In OData WebApi v7.5.9 and OData WebApi v8.0.2, we have added support for the queries below According to the spec only or query options can be applied to a segment. Note: For scalar primitive collections, only is applicable. For scalar complex collection, both and are supported. Prerequisites Let us create an ASP.NET Core Application using Visual Studio 201...
Support for fetching nested paths in OData Web API
Background OData services use nested paths to access properties or entities related to a resource. For example, if you want to access orders of a given customer, you would use a request path like: 7.x provides two main approaches for handling such requests: convention and attribute routing. In the first approach, we create controller actions with conventional naming patterns to handle specific scenarios. For example, if you want to handle fetching the customers entity set (), you would implement a method in the that returns the collection corresponding to the entity set as follows: To retrieve...
Build formatter extensions in ASP.NET Core OData 8 and hooks in ODataConnectedService
Introduction In this post, I will create formatter extensions in an OData web service and request/response hooks in an OData client application to generate/consume ETag control information. ETag (aka entity tag), one of OData control information that may be applied to an entity or collection in response, can be used in a subsequent request to avoid overwriting if the entity or collection's value has been changed by other requests. ETag value normally can be generated using concurrency properties automatically in OData, however, I’d like to use this post to share with you the ideas of how to extend serializati...
Tutorial: Creating a Service with ASP.NET Core OData 8.0 for .NET 5
In this document, we will walk through the process of creating a local service using OData 8.0, which is optimized to support ASP.NET Core 5. To learn more about the changes, check out ASP.NET Core OData 8.0 Preview for .NET 5 (which also references ASP.NET Core OData now Available), written by my colleague, Sam. You'll notice that this post has a lot of similarities; here, I'm aiming to consolidate our documentation and share my experience from the perspective of an intern new to OData. Topics Covered Software Used As always, ...
Up & Running w/ OData in ASP.NET 6
In this article, I'm going to walk you through the simplest way you can follow to get up and running with OData 8.0 on ASP.NET 6.0 - including source code examples, video walk-throughs and a glimpse into the future of OData.
API versioning extension with ASP.NET Core OData 8
Introduction API versioning can help evolving our APIs without changing or breaking the existing API services. URL segment, request header, and query string are three ways to achieve API versioning in ASP.NET Core application. ASP.NET Core OData 8, built upon ASP.NET Core, has the built-in API versioning functionality via route URL prefix template. For instance, the following code configures a version template in the route URL prefix to achieve URL based API versioning: Based on this configuration, it supports API versioning using URL segment as: ASP.NET Core OData 8 doesn't have the built-in ...
Attribute Routing in ASP.NET Core OData 8.0 RC
Introduction Attribute routing is how Web API matches the incoming HTTP requests to an action based on route template attributes decorated on controller or action. ASP.NET Core defines a set of route template attributes to enable attribute routing, such as RouteAttribute, HttpGetAttribute etc. ASP.NET Core OData 8.0 RC supports these attributes to enable you to define OData attribute routing endpoints. In this post, I would like to share details about the changes and usages of the attribute routing in OData ASP.NET Core OData 8.0 RC. The code snippets in this post are from this sample project. Please try and...
OData Connected Service 0.12.0 Release
OData Connected Service 0.12.0 has been released on the Visual Studio Marketplace. This release includes the following changes: Restored default settings Some default options were inadvertently changed in a previous update, leading to default options that do not make sense for the majority of use cases. We have restored the affected default values to more reasonable options: Visit this page to learn more about available settings and their impact on the code generation process. Support for reference models with relative URIs In previous version, you would get an...
Passing OData Query Options in the Request Body
The query options part of an OData URL can be quite long, potentially exceeding the maximum length of URLs supported by components involved in transmitting or processing the request. HTTP does not impose any limits on the length of a URL, however, many hosting environments (including IIS) impose limitations which may restrict the client's ability to request the exact set of data that they are interested in. These limitations would especially pose a big challenge for clients using explicit select statements for example. Background One way that you can go round these limitations is by wrapping the GET request in ...
Introducing the OData Web API Authorization library
This post introduces the Web API Authorization library which automatically enforces the permissions defined in your OData model on your Web API endpoints.
OData Connected Service 0.11.1 Release
This post announces release of OData Connected Service v0.11.1 and its new features and bug fixes.
Routing in ASP.NET Core OData 8.0 Preview
Introduction In the previous version of ASP.NET Core OData, such as 6.x and 7.x version, the OData routing is IRouter-based Web API Routing, that is, OData router is a Router implementing IRouter interface. Even in the ASP.NET Core OData 7.x Endpoint Routing, it is also related to the IRouter routing. Since 8.0, we want to build the OData routing really on ASP.NET Core Endpoint Routing and make the OData routing more "positive" as much as possible. In this post, we would like to share more details about the design and implementation of OData Routing in 8.0 preview. Since it's preview, we are wishfully looking...
ASP.NET Core OData 8.0 Preview for .NET 5
Recently, OData team released the 8.0.0 preview version of ASP.NET Core OData on nuget.org. It is the first version of OData supporting .NET 5, especially for ASP.NET Core 5. This version includes some breaking changes, such as model builder separation, namespace changes and configuration changes etc. Most importantly, the routing mechanism is changed a lot comparing to the previous 7.x version. This post is intended to introduce such changes using a basic tutorial about how to build OData service through ASP.NET Core OData 8.0 preview package. Besides, we are looking for requirements of features and reports o...
Dynamic properties container property in OData Client
When working with open types in an OData service, dynamic properties are held in a container property of type . However, support for a similar container property has traditionally been absent in OData client. For this reason, dynamic properties returned from an OData service could only be mapped to declared properties on the client backing type. Where the backing types are autogenerated using a code generator like OData Connected Service, the developer would augment the autogenerated class with a partial class, to avoid messing around with the autogenerated code. For instance, for a property returned as a dyn...
All in One with OData $Batch
Introduction We talked in the past about some of the most powerful features OData has to offer such as shaping, filtering and ordering your data all within your API request. But with an API GET request you can only do so much before you reach the maximum length of a URL which is a standard limitation. For instance, let's assume we are looking for information for a particular set of students. If the set is as little as 5 or 10 students, the request might be feasible with a simple API call such as this: But the problem with that approach is that it doesn't scale very well. For instance, if you are looking...
OData Connected Service 0.10.0 Release
OData Connected Service 0.10.0 has been released and is available in the Visual Studio Marketplace. This release includes the following features and fixes: 1. Support for Open Types Open Types are entity or complex types in OData which have dynamic properties (i.e. properties not declared in the schema). Previously, OData Connected Service did not provide support for dynamic properties in open types. Starting with this version, if a type is marked as open in the service model, OData Connected Service will generate a dictionary called as a property of that type. The will be applied to that prop...
Exploring Graph Native Support for OData
We talked in previous articles about the amount of enterprise technologies that offer OData out-of-the-box for it’s RESTFul API communications. some of these technologies are widely spread such as SharePoint, SAP, SQL Server and so many other technologies that leverage a multi-billion user powerful technology like OData. In this article, I’m going to show you how you can leverage OData with Microsoft Graph, so you can power your applications with extensive capabilities to search, sort, order and filter all users information, including calendars, security groups, mail and so much more within Microsoft Graph wit...
OData Model Builder now Available
How to empower developers to build OData Edm model easily from their data model (C# classes) is one of the most important task in OData team. Today, we are pleased to announce the first beta version of OData model builder available at https://www.nuget.org/packages/Microsoft.OData.ModelBuilder. Please try this package by installing as: The basic usage of the Edm model is to use the conventional model builder, here's sample codes For all other detail usage of the model builder, please refer to: https://docs.microsoft.com/en-us/odata/webapi/model-builder-abstract To release model builder as a si...
OData Connected Service 0.9.1 Release
Good News! A new version of OData Connected Service is now available in the Visual Studio Marketplace. The new version adds the following new features and bug fixes/enhancements: Features Bug Fixes/Enhancements Auto-selects the last metadata endpoint used in generating proxy classes The endpoint dropdown contains a list of all the recent endpoints used in generating proxy classes as shown above. This feature auto selects the most recent endpoint used in generating proxy classes. This is important when you are working with an endpoint undergoing frequent changes and that requires...
Aggregation extensions in OData ASP.NET Core
$select and $filter, as well as other OData query options, are an excellent way to receive only data that you need. However, they might not be the best option for reporting and analytical applications. If you want to get total sales to the particular customer and using only $select and $filter, you end up selecting all orders for that customer and doing aggregation client-side. This approach means sending a lot of data over the network. If you need to show sales by region, product category, you have to send almost all the data. Fortunately, OData v4.0 specification includes an aggregation extensions which allo...
OData Connected Service 0.9.0 Release
OData Connected Service 0.9.0 has been released and is now available on Visual Studio Marketplace. This release adds the following features and bug fixes: You can get the extension from Visual Studio Marketplace
OData Connected Service v0.8.0 Release
OData Connected Service 0.8.0 has been released and is now available on the Visual Studio Marketplace. The new version adds the following features: There instances where you want to re-use same configuration settings across multiple projects. Manually supplying the same settings every time you spin up a new project is redundant. This feature enables one to load code generation values to the OData Connected Service wizard from a json file. This means that you can either type these values or you can load them from a json file. To use this feature: Create a new json file...
Move OData to .NET 5
Introduction Along with the Announcing .NET 5 preview 1, it’s time to move OData to .NET 5. This blog is intended to describe how easy to move the BookStore sample introduced in ASP.NET Core OData now Available onto .NET 5. Let's get started. Install .NET 5 .NET 5 SDK is required to build the .NET 5 application. So, Let’s follow up the instructions in Announcing .NET 5 preview 1 to install the .NET 5 SDK. Meanwhile, I also install the Visual Studio 2019 Preview to edit and compile the .NET 5 project. It's easy to download Visual Studio 2019 Preview from here. The required VS version supporting .NET 5 is...
OData Connected Service 0.7.1 Release
We are pleased to announce a new release of OData Connected Service, version 0.7.1. This version adds the following important features and bug fixes: You can get the extension from the Visual Studio Marketplace. 1. VB.NET Support You can now use OData Connected Service extension to generate OData client code for Visual Basic projects. The features supported in C# are also supported in VB.NET projects. Let’s create a simple VB.NET project to demonstrate how it works. Open Visual Studio and create a VB .NET Core Console App. When the new project is ready, right-click the project node fr...
OData Connected Service version 0.6.0 Release
OData Connected Service 0.6.0 has been released and is available in the Visual Studio Marketplace. The new version adds the following features: Custom Http Headers This feature allows you to add headers that will be sent with the request that fetches the metadata used in generating proxy files. This is actually important when using protected metadata to generate proxy files. To access the metadata endpoint, you may be required to pass authorization headers as shown below. These values are not stored within the OData Connected Service or in your computer and you are required to provide them a...
OData Connected Service version 0.5.0 Release
OData Connected Service 0.5.0 has been released and is available in the Visual Studio Marketplace. The new version has the following new features: In addition to the above features, the new version has the following improvements and fixes: Microsoft.OData.Client v7.6.3 OData Connected Service version 0.5.0 comes with Microsoft.OData.Client v7.6.3 which has great improvements: Some of the improvements are: Supports Mocking of the generated functions and properties The generated methods and properties can be mocked for purposes of tes...
OData Connected Service 0.4.0 Release
OData Connected Service 0.4.0 has been released and is now available on the Visual Studio Marketplace. The new version adds the following features: In this article, I would like to take you through some key new features and get you up to speed with using the OData Connected Service. OData Connected Service in Visual Studio 2019 We start by illustrating how you can use the extension in Visual Studio 2019. Open Visual Studio 2019 and create a new C# .Net Core Console project. Let’s call the project "SampleClient", and the solution "OCSTest". Once the project is open, click the Extensions menu,...
Migrating OData V3 Services to OData V4 without Disrupting Existing Clients
The migration from your existing OData V3 services to V4 can be challenging if there are some clients that cannot be easily upgraded, like the ones running on on-premises resources. The OData V3 services will need to be kept running until the old clients have been phased out, incurring maintenance overhead. OData team recently released an extension to overcome the challenge. This extension eases the transitioning by enabling OData V4 services to serve OData V3 requests. The advantage is that no changes are needed on the OData V3 clients while the OData V3 services are migrated to OData V4. In this article, I a...
Enabling Endpoint Routing in OData
Few months ago we announced an experimental release of OData for ASP.NET Core 3.1, and for those who could move forward with their applications without leveraging endpoint routing, the release was considered final, although not ideal. But for those who have existing APIs or were planning to develop new APIs leveraging endpoint routing, the OData 7.3.0 release didn't quiet meet their expectations without having to disable endpoint routing. Understandably this was quite a trade off between leveraging the capabilities of endpoints routing versus being able to use OData. Therefore in the past couple of months t...
Integrating Cosmos DB with OData (Part 3)
Sometimes requiring to build an entire ASP.NET Core application just for the purpose of exposing a RESTFul API endpoint to give your API consumers the ability to query, filter and order the data could be a bit of an overhead, especially if you are not planning on adding in any additional business logic between your data and it's consumers. It's not also a very cost effective solution when it comes to the development effort, maintenance, infrastructure and all the bells and whistles that accompany developing a custom ASP.NET Core API. If that's the case for your task, Cosmos DB offers native support for ODat...
$select Enhancement in ASP.NET Core OData
The release of ASP.NET Core OData v7.3 brings a ton of improvements to $select functionality. In this article, I’d like to introduce some of the new features of $select and its usages in combination with other query options like $filter, $top, $skip, $orderby, $count and $expand. This tutorial assumes that you already have the knowledge to build an ASP.NET Core Web Application service using ASP.NET Core OData NuGget package. If not, start by reading ASP.NET Core OData now Available and refer to the sample project used in this article. Let’s get started. Data Model As mentioned, we are going to skip the steps ...
Experimenting with OData in ASP.NET Core 3.1
A lot of developers have asked me recently about OData compatibility with ASP.NET Core 3.0 and again with .NET Core 3.1 after it’s very recent release. This demand became more and more critical with the recent announcement from the .NET team around .NET Core 2.2 reaching the end of its life on Dec 23rd of this year. And because of all of that, the OData team at Microsoft have been working diligently in the last few months to ensure a stable release of OData that supports .NET Core 3.1 makes it out to the public as soon as possible. And while the final release might take a bit longer to be production-read...
Optimizing Web Applications with OData $Select
OData as an API technology comes in with so many options that gives API consumers the power to shape, filter, order and navigate through the data with very few lines of code. In my previous articles I talked in details about how to enable OData on your existing ASP.NET Core API using the EDM model, in addition to that I have provided a code example for you to be able to test the capabilities of OData on your own machine. In this article, I suggest you keep the very same source code handy to learn more about one of the most powerful query options of OData, which is $select Introduction to OData $Select O...
Customize Control Information for full metadata requests in odata.net
Background OData supports three metadata levels for the JSON format, namely - No Metadata as the name suggests does not include control information other than nextLink and count. Minimal metadata responses usually include context, etag, deltalink etc. whereas full metadata responses contain all the control information like navigationLink, assciationLink, readLink, mediaReadLink etc. ODataMetadataSelector With odata.net >=7.6.1, it will be possible to customize what metadata gets written out. A new class, ODataMetadataSelector is introduced which exposes methods that can be overridden to add...
Using SkipToken for Paging in Asp.Net OData and Asp.Net Core OData
Loading large data can be slow. Services often rely on pagination to load the data incrementally to improve the response times and the user experience. Paging can be server-driven or client-driven: Client-driven paging In client-driven paging, the client decides how many records it wants to load and asks the server for that many records. That is achieved by using $skip and $top query options in conjunction. For instance, if a client needs to request 10 records from 71-80, it can send a similar request as below: However, this is problematic if the data is susceptible to change. In case of a deletion in betwee...
Integrating Cosmos DB with OData (Part 2)
In the first article of this series, we talked about integrating Cosmos DB with ASP.NET Core application powered by OData using a pre-built solution that was using Cosmos Client to run full CRUD operations. But that's not the only way we can work with Cosmos DB from ASP.NET Core - there are two more approaches that we could follow to work with this great technology. In this article we are going to leverage the power of the Entity Framework to communicate with Cosmos DB then add OData on top of that to supercharge our API with even more functionality that makes querying, filtering and navigating the data in ...
Integrating Cosmos DB with OData (Part 1)
We talked in previous articles about the pluggability of OData with any storage technology regardless of its schema, whether it’s a SQL-based storage, NoSQL, In-Memory or simply a file on a hard-drive. This power of OData enables developers to work with powerful, planet-scale storage technologies such as Cosmos DB. In this article we are going to deep dive into one of three ways you can integrate Cosmos DB with OData but before we start, let’s talk a little bit about Cosmos DB, it’s capabilities and why it’s important to be able to expose that storage powerful through an API with OData. What is C...
Enabling Pagination in Blazor with OData
Summary We talked in a previous article about enabling OData in your existing ASP.NET Core API using EDM. One of the biggest advantages of following that method is to be able to take advantage of functionality such as count to enable an on-demand function in almost every web application such as navigation. In this article, we are going to talk about navigation from an abstract perspective as a plain API call, then leverage that power in a Blazor application to enable data navigation or pagination. API Navigation Clone and run the example project I built for OData with EDM and run the project th...
Simplifying EDM with OData
Summary In a previous article, I talked about how you can leverage the power of OData with your existing ASP.NET Core API to bring in more features to your API consumers. But there are different ways you could enable OData on your existing API that are just as simple but offers more powerful features than overriding your existing routes and enabling dependency injection. For instance, if you’ve tried to perform a count operation using our previous method you will notice it doesn’t really return or perform anything, the same thing goes with many other features that we will talk about extensively in future a...
Supercharging ASP.NET Core API with OData
Summary In this article, I’m going to show you how you can supercharge your existing ASP.NET Core APIs with OData to provide better experience for your API consumers with only 4 lines of code. For the purpose of this tutorial please clone our demo project WashingtonSchools so you can follow up and try the different features we are going to talk about in this article. You can clone the demo project from here: https://github.com/hassanhabib/ODataDemo What is OData? Let’s talk about OData … OData is an open source, open protocol technology that provides the ability to API developers to devel...
ASP.NET Core OData now Available
Introduction The Microsoft OData Team is proud to announce general availability (GA) of OData (Open OData Protocol) on ASP.NET Core 2.0. It is now available through Nuget package at https://www.nuget.org/packages/Microsoft.AspNetCore.OData, current its version is 7.0.0. Along this release, it will allow customers to create OData v4.0 endpoints and leverage the OData query syntax easily on multiple platforms, not only on Windows. This blog is intended to give you a tutorial about how to build/consume OData service through ASP.NET Core OData package. Let’s getting started. ASP.NET Core Web Application For ...
[Announcement] RESTier v0.6.0 Release
We are happy to announce that the RESTier 0.6.0 is released and available on NuGet. 0.6.0 is a release add fix several issues and add several key features, it has minor public API change comparing with previous release. Detailed release notes for v0.6.0 can be found here. This is a quick preview of the items included in 0.6.0 release, New features since 0.5.0-beta Bug-fixes since 0.5.0-beta A sample service is also created with newest package used and includes kinds of new features, refer to Trippin Samples for source code. Anyone who uses previous version of R...
[Announcement] RESTier v0.5.0 Release
We are happy to announce that the RESTier 0.5.0-beta is released and available on NuGet. 0.5.0-beta is a big release, it adopts dependency injection to provide lots of flexibility to consumers, it also adds many new features, fixes kinds of issues. Detailed release notes for v0.5.0-beta can be found here. Note beta is used in version is caused by the dependency injection package is not GAed yet, official version number cannot be used. And there is no plan to release 0.5.0. A sample service is also created with newest package used and includes kinds of new features, refer to Trippin Samples for source code. An...
[Announcement] Web API OData v5.9 Release
We are happy to announce that the Web API OData v5.9 is released and available on NuGet. Detailed release notes for v5.9 can be found here. Thanks your support. You and your team are highly welcomed to try out this new version if you are interested in the new features and issues fixed. For any feature request, issue or idea please feel free to reach out to us at [WebApi@Github].
[Ecosystem] Microsoft Power Query for Excel Releases Support for OData V4
We are pleased to pass the announcement of the enhanced support for OData V4 in the latest release of Power Query for Excel. Microsoft Power Query for Excel is an Excel add-in that enhances the self-service Business Intelligence experience in Excel by simplifying data discovery, access and collaboration. Microsoft Power Query for Excel has supported OData since its first release. The long awaited support for the OASIS OData V4 Standard entered private preview earlier this year and was officially released last week. This release addresses customer demand to take advantage of the growing number ...
[Announcement] ODataLib 5.6.4 Release
We are happy to announce that the ODataLib 5.6.4 is released and available on NuGet. Detailed release notes are listed below: New Features: [GitHub issue #144] ODataLib now suppresses the errors in reading open entity’s undeclared collection or complex property value Bug Fixes: [GitHub issue #60] Fix an issue that $select does not work with EntityFramework 5 Call to Action: You and your team are highly welcomed to try out this new version if you are interested in the new features and fixes above. For any feature request, issue or idea please feel free to reach out to us at odatafeedback@microsoft.com.