Freigeben über


2.2.6.5.1 Complex Type

A ComplexType property, defined on an EntityType, MUST be represented in the same way as it is within in the Atom-based format, as specified in section Complex Type (section 2.2.6.2.3); however, the XML element representing the ComplexType instance as a whole MUST be the root of the XML document (for example, not a child element, as described in section Complex Type (section 2.2.6.2.3)). For example, the Address property of type CAddress (a ComplexType) in the sample model (see Appendix A: Sample Entity Data Model and CSDL Document (section 6)) is represented in the following listing.

If the value of the ComplexType is null, the element MUST be empty and MUST include the m:null attribute set to true, as required by the Common Serialization Rules for XML-based Formats (section 2.2.6.3.1).

 <?xml version="1.0" encoding="utf-8"?>
 <Address xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices">
   <Street>57 Contoso St</Street>
   <City>Seattle</City>
 </Address>

Listing: XML-formatted Complex Type