Nested projections

Posts   
 
    
rboarman
User
Posts: 83
Joined: 01-Feb-2005
# Posted on: 03-Feb-2009 00:32:29   

Hello,

I am trying to use DataProjectorToCustomClass to project data read from my tables onto my own classes. My question is how to handle nested data. I have classes nested several levels deep. Each class contains a List<t> to hold the children. The use of List<t> is up for debate as well. Maybe there's a better structure?

Is there a way to do a deep read and then project the results onto my deep class structure? Assuming not, how would you suggest I work around this limitation?

Thank you,

Rick

Using v2.6 Adapter

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 03-Feb-2009 09:06:12   
rboarman
User
Posts: 83
Joined: 01-Feb-2005
# Posted on: 03-Feb-2009 17:53:11   

Walaa wrote:

Please check Hierarchical projections of entity collections

It mentions projecting onto DateSets and Dictionaries. What about custom classes? Is there an example anywhere?

Thank you,

Rick

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 03-Feb-2009 21:14:25   

There is a sample in the documentation here

Matt

rboarman
User
Posts: 83
Joined: 01-Feb-2005
# Posted on: 03-Feb-2009 22:40:31   

Maybe I am missing something. This topic is about how to handle nested projections. I don't see that in the example.

Thanks,

Rick

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 04-Feb-2009 10:06:13   

Is Linq an option?

rboarman
User
Posts: 83
Joined: 01-Feb-2005
# Posted on: 04-Feb-2009 16:20:40   

Walaa wrote:

Is Linq an option?

Sure. The question is, what is the best way to handle projcting nested database objects onto a class structure.

Thanks,

Rick

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 04-Feb-2009 16:54:00   

Linq would be the best way to do it.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39859
Joined: 17-Aug-2003
# Posted on: 05-Feb-2009 11:46:56   

See: http://www.llblgen.com/documentation/2.6/Using%20the%20generated%20code/Linq/gencode_linq_generalusage.htm#HierarchicalSets

the example is with entities, but you can also project to anonymous types or custom classes.

Frans Bouma | Lead developer LLBLGen Pro