The Open Data Protocol (OData) is a data access protocol created for the web. OData gives a consistent procedure to query and manipulates data sets via CRUD operations (Create, Retrieve, Update, and Delete). ASP.NET web API supports each of the v3 and v4 protocol.
ASP.NET Web API 2, support for $expand
, $select
, and $value
options added for OData. These options simplify to control the representation that is returned from the server.
$expand:
Normally, response doesn’t include related entities if we query an OData collection. By using $expand, we can get related entities inline in response.$select:
It’s used if we wanted to include subset of properites in response instead of all.$value:
It allows to return raw value of the property instead returning in OData format.