ConvertTypedListToEntityCollection()

Posts   
 
    
Jeff M
User
Posts: 250
Joined: 04-Aug-2004
# Posted on: 01-Aug-2005 22:13:55   

Hello fellow LLBLGen'ers

Has anyone written a generic:

public EntityCollectionBase2 ConvertTypedListToEntityCollection(TypedListBase list)
{}

method?

I know that it probably won't be that hard to write the thing (using reflection), but I hate to reinvent the wheel.

Anybody?

Thanks in advance.

Jeff

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 02-Aug-2005 11:29:03   

You need the type of entity which is represented by one row in the typed list. Then use the factory for that type and produce an entity. Then per row, per column of the typed list, set the corresponding field, by using newentity.SetNewFieldValue(columnName, value); and add the entity to the entity collection.

Frans Bouma | Lead developer LLBLGen Pro