I’m using WCF Data services.
The default feed property for an entity in my OData service is
<feed xml:base="http://localhost:54527/DataModel.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">
How can I add my own name spaces to this list in the feed property?
I’m trying to make my odata service GeoRSS compatible, I’ve added some EntityPropertyMappingAttribute’s to make the data compatible, but it isn’t being recognised by the tool we’re using.
Right now it’s producing this:
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
<feed xml:base="http://localhost:54527/DataModel.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">
<title type="text">Collars</title>
<id>http://localhost:54527/DataModel.svc/Collars</id>
<updated>2011-11-07T09:23:05Z</updated>
<link rel="self" title="Collars" href="Collars" />
<entry>
<id>http://localhost:54527/DataModel.svc/Collars(HOLEID='ABL001',PROJECTCODE='ACA')</id>
<title type="text"></title>
<updated>2011-11-07T09:23:05Z</updated>
<author>
<name />
</author>
<link rel="edit" title="Collar" href="Collars(HOLEID='ABL001',PROJECTCODE='ACA')" />
<category term="Neo.Collar" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:HOLEID>ABL001</d:HOLEID>
<d:PROJECTCODE>ACA</d:PROJECTCODE>
<d:TENEMENTID>5853</d:TENEMENTID>
<d:LAT>116.49531406</d:LAT>
<d:LONG>-21.65159678</d:LONG>
</m:properties>
</content>
<geo:lat xmlns:geo="http://www.georss.org/georss">116.49531406</geo:lat>
<geo:long xmlns:geo="http://www.georss.org/georss">-21.65159678</geo:long>
</entry>
But I would rather have the geo namespace up the top:
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
<feed xml:base="http://localhost:54527/DataModel.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"
xmlns:geo="http://www.georss.org/georss">
<title type="text">Collars</title>
<id>http://localhost:54527/DataModel.svc/Collars</id>
<updated>2011-11-07T09:23:05Z</updated>
<link rel="self" title="Collars" href="Collars" />
<entry>
<id>http://localhost:54527/DataModel.svc/Collars(HOLEID='ABL001',PROJECTCODE='ACA')</id>
<title type="text"></title>
<updated>2011-11-07T09:23:05Z</updated>
<author>
<name />
</author>
<link rel="edit" title="Collar" href="Collars(HOLEID='ABL001',PROJECTCODE='ACA')" />
<category term="Neo.Collar" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:HOLEID>ABL001</d:HOLEID>
<d:PROJECTCODE>ACA</d:PROJECTCODE>
<d:TENEMENTID>5853</d:TENEMENTID>
<d:LAT>116.49531406</d:LAT>
<d:LONG>-21.65159678</d:LONG>
</m:properties>
</content>
<geo:lat>116.49531406</geo:lat>
<geo:long>-21.65159678</geo:long>
</entry>
I might be going about this completely the wrong way.
Thanks.
Currently there’s no way in WCF Data Services to do this. The Entity Property Mapping works locally (on the element it maps to), there’s no ability for it to specify that some namespaces should be declared up front.