找了好久才找到的:)
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=154939&SiteID=1
DataTable implements IXmlSerializable, and the schema for the DataTable is unique enough allowing wsdl.exe to take advantage of the new feature (SchemaImporterExtension) to generate DataTable on the client.
Here is what you need to do
- Create SchemaImporterExtension that will recognize the DataSetSchema:
The V2 Framework uses anonymous complexType for DataSet schema:
You need to write the extension that maps the above schema pattern to a DataTable type:
- Compile and GAC the SchemaImporterExtension
- Add it to the existent extensions in machine.config, ysing fully-qualified assembly name
<system.xml.serialization>
<schemaImporterExtensions>
<add name="DataTableSchemaImporterExtension" type="DataTableSchemaImporterExtension,
</schemaImporterExtensions>
</system.xml.serialization>
真麻烦,我还是喜欢用WriteXML()和ReadXml()方法来处理:)