OData is an open standard for querying data over the web. It allows us to expose metadata about a domain model and to query it using nothing more than HTTP verbs and the query string. It can be used, for example, to expose any data model as a REST API.
Previous versions of ASP.NET already supported it, and since version 2.0, it is also supported in ASP.NET Core through the Microsoft.AspNetCore.OData NuGet package.
In the case of ASP.NET Core, OData allows us to query, through the URL, any collection that implements IQueryable<T> or IEnumerable<T>; in the first case, this means that the query will not be executed in memory, but it will be translated to the data source-specific dialect. In the case of an object-relational mapper, such as Entity Framework (EF) Core or NHibernate, this is SQL.
Throughout the course of the following sections...