WCF NetCFSvcUtil makes a reference to Serialization.SerializationInfo

P

Philippe Requilé

I have a WCF service to retrieve a typed dataset.
I can retrieve the typed dataset in a windows forms application
(NetSvcUtil).

Now I want to use NetCFSvcUtil to generate a proxy for a smart device
application.
Unfortunately the tool generates code with:
protected
ChauffeurDataTableDataTable(global::System.Runtime.Serialization.SerializationInfo
info, global::System.Runtime.Serialization.StreamingContext context) :

But System.Runtime.Serialization.SerializationInfo is unknown in compact
framework.

Any suggestions to retrieve a typed dataset with WCF in a smart device
application?
 
B

Brendan

Hi Philippe,

I was having the same issue as you and I couldn't find any way around
it. In the end I decided to use LINQ 2 SQL objects on the server, as
they serialize better, and then populate a dataset on the client. What
I probably should have done is to use DataTable.WriteXml(stream) at
the service end, returning the raw XML, and then
DataTable.ReadXml(stream) on the client to populate the dataset. I
think this would work as long as the dataset has the same schema at
both ends. I haven't tested it out though ;)

Here's an example of reading XML back into a DataSet:
http://msdn2.microsoft.com/en-us/library/ekw4dh3f(VS.80).aspx

Hope this helps a bit.

Brendan
 
P

Philippe Requilé

Thanks Brendan, this is my code:

On the service side:
public string GetChauffeurDataSetXML()
{
ChauffeurDataSet chauffeurDTS = new ChauffeurDataSet();
System.IO.StringWriter swXML = new System.IO.StringWriter();
... (connect to db, select query)
dataAdapter.Fill(chauffeurDTS.Chauffeur);
chauffeurDTS.WriteXml(swXML);
return swXML.ToString();
}

On the client side:
ServiceReference.ServiceClient client = new
ServiceReference.ServiceClient();
string chauffeurXml = client.GetChauffeurDataSetXML();
System.IO.StringReader srXML = new
System.IO.StringReader(chauffeurXml);
chauffeurDataSet.Clear();
chauffeurDataSet.ReadXml(srXML);

It is important that the table names match in both datasets.
This didn't work:
dataAdapter.Fill(chauffeurDTS)
The table name of the fields in the xml string was "table1", and then the
client doesn't fill the right datatable 'Chauffeur'.

Philippe

"Brendan" <[email protected]> schreef in bericht

Hi Philippe,

I was having the same issue as you and I couldn't find any way around
it. In the end I decided to use LINQ 2 SQL objects on the server, as
they serialize better, and then populate a dataset on the client. What
I probably should have done is to use DataTable.WriteXml(stream) at
the service end, returning the raw XML, and then
DataTable.ReadXml(stream) on the client to populate the dataset. I
think this would work as long as the dataset has the same schema at
both ends. I haven't tested it out though ;)

Here's an example of reading XML back into a DataSet:
http://msdn2.microsoft.com/en-us/library/ekw4dh3f(VS.80).aspx

Hope this helps a bit.

Brendan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top