创建了一个 WCF 数据服务并让一切正常工作,但 xml 的格式并不完全符合我的需要,我似乎无法弄清楚如何摆脱所有额外的东西。我所拥有的是:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xml:base="http://172.1.2.2/Database/DatabaseTables.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">
<id>http://172.1.2.2/Database/DatabaseTables.svc/Device('999')</id>
<title type="text"></title>
<updated>2013-05-14T18:17:10Z</updated>
<author>
<name />
</author>
<link rel="edit" title="Device" href="Device('999')" />
<category term="Model.Device" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:Device_Code>999</d:Device_Code>
<d:Short_name>TC2</d:Short_name>
</m:properties>
</content>
</entry>
我想要的是:
<Device>
<Device_Code>999</Device_Code>
<Short_name>TC2</Short_name>
</Device>
我已经将 name 属性添加到数据合同中,但它没有改变任何东西。