Freigeben über


2.2.6.2.2.1 Entity Type (as an Atom Entry Element) with a Customizable Feed Property Mapping

If the EntityType instance that is represented includes customizable feed annotations in the data services metadata document, the properties with custom mappings are represented as directed by the mappings information specified in Conceptual Schema Definition Language Document Extensions for Customizable Feeds (section 2.2.3.7.2.1). Properties that do not have customizable feed mappings defined are represented according to the previous section, Entity Type (as an Atom Entry Element) (section 2.2.6.2.2).

In the OData 2.0 protocol, if the property of an EntityType instance in a data service response includes customizable feed annotations in the data services metadata document and has a value of null, the element or attribute being mapped to MAY be present and MUST be empty.

For example, the Employee EntityType instance that is described in Appendix A: Sample Entity Data Model and CSDL Document (section 6) is represented in Atom as described in the following listing.

 <?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:m="http://schemas.microsoft.com/ado/2008/11/dataservices/metadata"
        xmlns:gml="http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd"
        xmlns="http://www.w3.org/2005/Atom" m:etag="W/"X'000000000000FA01'"">
   <category term="SampleModel.Employee"
             scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
   <id>http://host/service.svc/Employees(1)</id>
   <title type="text">Eric Gruber</title>
   <updated>2008-03-30T21:32:23Z</updated>
   <author>
     <name />
   </author>
   <link rel="edit" title="Employees" href="Employees(1)" />
   <content type="application/xml">
    <m:properties>
     <d:EmployeeID>ALFKI</d:EmployeeID>
     <d:Address>
       <d:Street>4567 Main Street<d:Street>
       <d:City>Seattle</d:City>
       <d:Location m:type="Edm.GeographyPoint"><gml:Point srsName="4326">-127.345345 48.23423</gml:Point></d:Location>
     </d:Address>
     <d:Version>BBBBBBBB+gE=</d:Version>
    </m:properties>
   </content>
   <emp:Location xmlns:emp="http://www.microsoft.com">Seattle</emp:Location>
 </entry>

Listing: Atom-formatted Customer Entity with a Property Mapping