OData

Create and consume RESTful APIs in a simple and standard way

Latest posts

Deep insert support in OData Web API
Jun 9, 2023
0
0

Deep insert support in OData Web API

Kennedy Kangethe Munga
Kennedy Kangethe Munga

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
Mar 14, 2023
0
1

Enable CBOR within ASP.NET Core OData

Sam Xu
Sam Xu

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
Mar 9, 2023
7
2

Customize OData payload serialization format within ASP.NET Core OData

Sam Xu
Sam Xu

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
Dec 28, 2022
1
4

Bulk Operations Support in OData Web API

Elizabeth Okerio
Elizabeth Okerio

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
Sep 7, 2022
0
4

Extension: Omit null value properties in ASP.NET Core OData

Sam Xu
Sam Xu

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
Aug 17, 2022
0
3

Using the new JSON writer in OData

Clément Habinshuti
Clément Habinshuti

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
Apr 20, 2022
2
0

Tutorial: Build gRPC & OData in ASP.NET Core

Sam Xu
Sam Xu

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
Feb 22, 2022
0
0

Customizing $filter for spatial data in ASP.NET Core OData 8

Kennedy Kangethe Munga
Kennedy Kangethe Munga

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
Jan 11, 2022
10
0

$compute and $search in ASP.NET Core OData 8

Sam Xu
Sam Xu

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