Passing DataTable across web/wcf services

Published 01 August 07 01:46 PM | Lifeng Lu 

Passing DataTable (without embeded into a dataset) across web services is supported in .Net 2.0 framework.  However we found a bug in this area, which might affect using this feature with strong typed dataTable.  For example, when a web service function wants to return a DataTable to the client, an independent dataTable (a dataTable which is not a part of a dataset) will work, but a dataTable inside a dataSet won't work.  What happens is that the client side couldn't deserialize the dataTable from wire.  The root reason is the DataTable inside a dataset inherits a schema namespace from the dataSet, but an independent datatable has an empty namespace (unless we change it).  Data cannot be changed between two dataTables with different namespace.

The problem is that the instance of the dataTable on the client side is created by framework directly. It is impossible to change the namespace without changing generated strong type dataset code.  To work around this issue, the server side need copy data to an independent dataTable before passing it to the client.

That affects both .Net 2.0 web services and 3.0 Windows communication fundation services.

 

Filed under: ,

Comments

# “The underlying connection was closed: The connection was closed unexpectedly.” While returning Data Table from WCF service. « A Place for C Sharpers/.Netters said on September 22, 2008 1:28 AM:

PingBack from http://kiranpatils.wordpress.com/2008/09/22/the-underlying-connection-was-closed-the-connection-was-closed-unexpectedly-while-returning-data-table-from-wcf-service/

Anonymous comments are disabled

Search

This Blog

Others

Team members's blogs

Syndication

Page view tracker