2.2.6.2.6.1 Inline Representation

A request URI can include the $expand system query option to explicitly request that the entity or entities represented by a NavigationProperties property be serialized inline (rather than deferred), as described in Expand System Query Option ($expand) (section 2.2.3.6.1.3). The example that follows uses the same data model as the Deferred Content example referenced previously; however, this example shows the value of the Order's NavigationProperty serialized inline.

A NavigationProperty that represents an EntityType instance or a group of entities and that is serialized inline MUST be placed within a single m:inline element that is a child element of the atom:link element representing the NavigationProperty. Since a NavigationProperty identifies a collection of entities or a single entity, the contents of the m:inline element will be described in Entity Set (as an Atom Feed Element) (section 2.2.6.2.1) or Entity Type (as an Atom Entry Element) (section 2.2.6.2.2).

If NavigationProperty represents an EntityType instance and that instance is null, an empty m:inline element MUST appear under the atom:link element that represents NavigationProperty. If NavigationProperty represents a collection of entities and the collection is empty, an m:inline element with a nested atom:Feed element with no atom:Entry subelements MUST appear under the atom:link element that represents NavigationProperty. In both cases, the presence of the m:inline element indicates that NavigationProperty has been expanded but that no content was associated with it.

 <?xml version="1.0" encoding="utf-8"?>
 <entry  xml:base="http://host/service.svc/"
        xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
        xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
        xmlns="http://www.w3.org/2005/Atom">
   <category term="SampleModel.Customer"
             scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
   <id>http://host/service.svc/Customers('ALFKI')</id>
   <title type="text" />
   <updated>2008-03-30T21:32:23Z</updated>
   <author>
     <name />
   </author>
   <link rel="edit" title="Customers" href="Customers('ALFKI')" />
   <link 
        rel="http://schemas.microsoft.com/ado/2007/08/
        dataservices/relatedlinks/Orders" type="application/xml"  
        title="Orders"
        href="Customers('ALFKI')/$links/Orders" />
  
   <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Orders"
         type="application/atom+xml;type=feed"
         title="Orders"
         href="Customers('ALFKI')/Orders">
     <m:inline>
       <feed>
         <title type="text">Orders</title>
         <id>http://host/service.svc/Customers('ALFKI')/Orders</id>
         <updated>2008-03-30T21:52:46Z</updated>
         <link rel="self" title="Orders" href="Customers('ALFKI')/Orders" />
         <entry>
           <category term="SampleModel.Order"
             scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
           <id>http://host/service.svc/Orders(1)</id>
           <title type="text" />
           <updated>2008-03-30T21:52:45Z</updated>
           <author>
             <name />
           </author>
           <link rel="edit" title="Orders" href="Orders(1)" />
           <link
       rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Customer"
                 type="application/atom+xml;type=entry" title="Customer"
                 href="Orders(1)/Customer" />
           <link 
                rel="http://schemas.microsoft.com/ado/2007/08/
                dataservices/relatedlinks/Customer" type="application/xml"  
                title="Customer"
                href="Orders(1)/$links/Customer" />
  
           <link
       rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/OrderLines"
                 type="application/atom+xml;type=feed" title="OrderLines"
                 href="Orders(1)/OrderLines" />
           <link 
                rel="http://schemas.microsoft.com/ado/2007/08/
                dataservices/relatedlinks/OrderLines" type="application/xml"  
                title="OrderLines"
                href="Orders(1)/$links/OrderLines" />
           <content type="application/xml">
             <d:OrderID m:type="Edm.Int32">1</d:OrderID>
             <d:ShippedDate m:type="Edm.DateTime">1997-08-25T00:00:00</d:ShippedDate>
           </content>
        </entry>
        <entry>
           <category term="SampleModel.Order"
             scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
           <id>http://host/service.svc/Orders(2)</id>
           <title type="text" />
           <updated>2008-03-30T21:52:45Z</updated>
           <author>
             <name />
           </author>
           <link rel="edit" title="Orders" href="Orders(2)" />
           <link
        rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Customer"
                 type="application/atom+xml;type=entry" title="Customer"
                 href="Orders(2)/Customer" />
           <link 
                rel="http://schemas.microsoft.com/ado/2007/08/
                dataservices/relatedlinks/Customer" type="application/xml"  
                title="Customer"
                href="Orders(2)/$links/Customer" />
  
           <link
       rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/OrderLines"
                 type="application/atom+xml;type=feed" title="OrderLines"
                 href="Orders(2)/OrderLines" />
           <link 
                rel="http://schemas.microsoft.com/ado/2007/08/
                dataservices/relatedlinks/OrderLines" type="application/xml"  
                title="OrderLines"
                href="Orders(2)/$links/OrderLines" />
  
           <content type="application/xml">
             <d:OrderID m:type="Edm.Int32">2</d:OrderID>
             <d:ShippedDate m:type="Edm.DateTime">1997-10-03T00:00:00</d:ShippedDate>
           </content>
        </entry>
       </feed>
     </m:inline>
    </link>
   <content type="application/xml">
     <d:CustomerID>ALFKI</d:CustomerID>
     <d:CompanyName>Alfreds Futterkiste</d:CompanyName>
     <d:Address>
       <d:Street>57 Contoso St</d:Street>
       <d:City>Seattle</d:City>
     </d:Address>
     <d:Version>AAAAAAAA+gE=</d:Version>
   </content>
 </entry>

Listing: Version 3.0 Atom-formatted Customer Entity with the Order's NavigationProperty Value Formatted Inline