Emmanuel wrote:
Walaa wrote:
Yet Webservices don't transfer dataTables, you'll have to enclose them in a dataSets.
I can't seem to find any reference help on Datasets. I do a search on it and get references to classes with Dataset properties but clicking on one of those hyperlinks sends me to an invalid page in the help file. Just more FYI than anything else since it doesn't sound like Datasets will work for me since I need a subset of fields from multiple tables in my compact XML message.
TypedLists and TypedViews are derived classes from DataTable. They don't contain their own XML serialization code, but have to be used with a dataset.
So if you want to return a typedlist/view from a webmethod, you do:
[WebMethod]
public DataSet GetCustomers()
{
CustomersTypedList customers = new CustomersTypedList();
// fill it
...
DataSet dummy = new DataSet();
dummy.Tables.Add(customers);
return dummy;
}
The XML serialization code in .NET 1.x for DataTable objects is build inside the DataSet, not inside the DataTable. In .NET 2.0 you can just return the typedlist/typedview and it will work. There's no compact XML flag as the xml is produced by .NET, not by our code.
Walaa wrote:
If your TypedLists have fields that youy don't want, you may consider building your own dynamic lists.
Thanks. I read up on dynamic lists. It might work for me but I am now thinking that it would be easier for me if I used a class mapped to a db view (TypedView, I guess). If I could filter the rows in the view programmatically and then serialize it to 'compact' XML, I think that would be ideal for me. If using a view-mapped class is possible I'm guessing that I am back to using datasets, right? If so, where can I get more info on datasets (see my comments above).
By the way, if I need to go with dynamic lists I don't see a WriteXML method for TypedListDOA class. How do I serialize a dynamic list to XML?
Same as a typedlist/view: add it to a DataSet, use WriteXml on the DataSet.