Skip to content

Latest commit

 

History

History
60 lines (27 loc) · 2.19 KB

expand-node-instance-69bf7c9.md

File metadata and controls

60 lines (27 loc) · 2.19 KB

Expand Node Instance

An expand node instance causes related entities to be included inline in the response.

When reading an entity with a GET request, related entities can also be requested using the $expand statement on a navigation property. In this example, you want to read the data about customer “Posey” and the open sales orders for this customer (with navigation property “Customer_2_Salesorders”). Here is an example of this OData request:

Sample Code:

GET http://host/service/Customers(‘Posey’)?$expand=Customer_2_Salesorders

In the Client Proxy Framework, an expand expression is described by an expand node instance. It is created directly in the corresponding read request instance.

Note:

In OData Version 2, complex properties can't have associations, such as navigation properties. You can only define navigation properties in entity types. In OData Version 4, you can define navigation properties for a complex property.

An expand node instance is always created in the corresponding Request Instance. These request types can be used to create an expand node:

  • read entity

  • read entity list

  • read entity zero-to-one

The expand node instances add an expand expression into the underlying read request. You can also set the selected properties for each expand node. If not all properties of the expanded entity are returned, compare to GET http://host/service/Customers\(‘Posey’\)?$expand=Customer\_2\_Salesorders\($select=Date,Status\).

For examples of how to create and work with expand nodes, see $expand Option.

Related Information

Request Instance