Jun 22, 2020 03:02 PM|mgebhard|LINK
I have tried Strongly Typed datasets in the past. But it seems that typed Datasets do not work well with futire platforms, see below article:
Services should pass simple types like strings and integers. This has always been a recommendation for building services in the .NET framework. It makes sense if you think about it. Services should return platform agnostic types so it can be used
by an client.
What's actually happening is the WCF Web Service Reference provider is generating a List<XElement> inside of a custom ArrayOfXElement rather than a DataSet. I assume that's because the DataSet is not recommended and could be deprecated in the future.
Anyway, the response is the schema and a diffset.
One option is opening the code generated reference.cs file and change the references from ArrayOfXElement to DataSet. This will work until the reference is
Another option is converting the List<XElement> to a DataSet.
private async Task<DataSet> ConvertToDataSet()
ServiceClient wcfClient = new ServiceClient();
DataSetDemoResponse result = await wcfClient.DataSetDemoAsync();
ArrayOfXElement arrayOfXElement = result.DataSetDemoResult;
StringBuilder sb = new StringBuilder();
foreach(var x in arrayOfXElement.Nodes)
byte bytes = Encoding.ASCII.GetBytes(sb.ToString());
MemoryStream ms = new MemoryStream(bytes);
DataSet ds = new DataSet();
The best option is passing strong types.