找了好久才找到的:)
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

  1. Create SchemaImporterExtension that will recognize the DataSetSchema:

The V2 Framework uses anonymous complexType for DataSet schema:

Web Service返回DataTable(zz)<s:complexType>
Web Service返回DataTable(zz)    
<s:sequence>
Web Service返回DataTable(zz)      
<s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax" />
Web Service返回DataTable(zz)      
<s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax" />
Web Service返回DataTable(zz)    
</s:sequence>
Web Service返回DataTable(zz)
</s:complexType>
Web Service返回DataTable(zz)

You need to write the extension that maps the above schema pattern to a DataTable type:

Web Service返回DataTable(zz)class DataTableSchemaImporterExtension : SchemaImporterExtension
}

 

  1. Compile and GAC the SchemaImporterExtension
  2. Add it to the existent extensions in machine.config, ysing fully-qualified assembly name
    Web Service返回DataTable(zz)<system.xml.serialization>
    Web Service返回DataTable(zz)   
    <schemaImporterExtensions>
    Web Service返回DataTable(zz)        
    <add name="DataTableSchemaImporterExtension" type="DataTableSchemaImporterExtension,Web Service返回DataTable(zz)        </schemaImporterExtensions>
    Web Service返回DataTable(zz)
    </system.xml.serialization>
    Web Service返回DataTable(zz)



    真麻烦,我还是喜欢用WriteXML()和ReadXml()方法来处理:)

相关文章: