Create Project from TypedList

Posts   
 
    
Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 12-Nov-2007 22:19:00   

I would like to project the results of a fetch typed list operation onto my DTO. Is there a sample or documentation somewhere that says how to do this?

I looked @ .NET 2.0 projection to custom classes in the adapter section of the how do i help topic. This works with an entity collection.

Data being retreived is always read only and I only need a subset of the fields contained in the entity, so I am working with a typed list and not an entity collection.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 13-Nov-2007 11:16:20   

You may fetch a DynamicList as an IDataReader and Project the results into a custom class.

For more details please refer to the LLBLGen Pro manual "Using the generated code -> Adapter/SelfServicing -> Fetching DataReaders and projections"

Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 13-Nov-2007 21:06:28   

Thanks for the quick reply. Sorry for being short, but I realize that I can fetch a reader and create a projection from that. I also realize that I can fetch an entity collection and create a projection from that as well.

I alrady have a TypedList and my typed list is fetched.

Can I use a typed list that has been fetched with data as a source of a projection?

Yes or No?

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 14-Nov-2007 11:14:42   

Can I use a typed list that has been fetched with data as a source of a projection?

Yes or No?

No, I mean Yes confused you took me by surprise simple_smile

I think you can since the TypedLis has all the information needed by the Projection methods ( dao.GetAsProjection or adapter.FetchProjection). You will have to pass the fields, relations...etc found on the TypedList. try using typedlist.GetFieldsInfo() & typedlist.GetRelationInfo().

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 15-Nov-2007 10:48:59   

Though not with an in-memory TypedList (so data already fetched).

Frans Bouma | Lead developer LLBLGen Pro