OData
Create and consume RESTful APIs in a simple and standard way
Latest posts

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