Compact XML for TypedLists?

Posts   
 
    
Emmanuel
User
Posts: 167
Joined: 13-Jan-2006
# Posted on: 31-Jan-2006 23:17:56   

I am new to LLBLGen and am experimenting with it as a potential tool for a webservices app I am writing.

I would like to generate the 'compact' XML for a TypedList. It appears that this is not possible (non of the overloads have 'XMLFormatAspect' as a param type which is required to specify 'compact').

My TypedList is constructed from a selection of columns from a half dozen tables or so.

What can I do instead? Note that I am using self-servicing classes (I don't want to move to adapter classes unless I have to).

Answer
User
Posts: 363
Joined: 28-Jun-2004
# Posted on: 01-Feb-2006 03:09:20   

a typedlist is nothing more then a datatable, thats why there is no compact option.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 01-Feb-2006 06:51:14   

If you move around with dataTables (TypedLists), it won't differ to use Selfservicing or Adapter.

Yet Webservices don't transfer dataTables, you'll have to enclose them in a dataSets.

If your TypedLists have fields that youy don't want, you may consider building your own dynamic lists.

Please refer to: "Using the generated code - SelfServicing - Using dynamic lists" in the LLBLGen Pro documentation.

Emmanuel
User
Posts: 167
Joined: 13-Jan-2006
# Posted on: 01-Feb-2006 16:04:26   

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.

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?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 02-Feb-2006 11:54:59   

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.

Frans Bouma | Lead developer LLBLGen Pro
Emmanuel
User
Posts: 167
Joined: 13-Jan-2006
# Posted on: 02-Feb-2006 14:51:40   

Thanks Otis. I understand.

Bing Ping
User
Posts: 15
Joined: 21-Dec-2012
# Posted on: 25-Jan-2013 18:47:15   

Emmanuel wrote:

Thanks Otis. I understand.

I just updated my code from 2.0 to 3.1 and found the webmethod that is used to return typedlist/typedview now returns dataset/datatable. And the reference.cs is auto-generated. It is weird. Is something wrong with LLBLGen pro 3.1?

I am using VS 2010 C# with framework 3.5.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 26-Jan-2013 11:45:31   

I'll close this thread as your question has nothing to do with the thread you re-opened. Start a new thread for your problem please. It's not the first time you do this, please start a new thread for your own problem, don't re-open random old threads which have no relationship with your problem.

Frans Bouma | Lead developer LLBLGen Pro