How to dynamically load a collection/entity by name

Posts   
 
    
Posts: 24
Joined: 19-Feb-2007
# Posted on: 27-Oct-2009 03:30:45   

Hi,

I have 2.6 final running self servicing.

I there a way to load and return a generic form of a collection.

i.e.(code below is theoretical)

private ICollection GetCollectionByName(string CollectionName) {

ICollection dt = DbUtils.GetCollectionByName(CollectionName);
return dt;   

}

RadGrid1.ItemsSource= GetCollectionByName("Customers");

Maybe something in the Factory Classes?

Thanks.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 27-Oct-2009 04:49:41   

You could use this:

IEntityCollection coll = GeneralEntityCollectionFactory.Create(EntityType.CustomerEntity);

Wrap it in a method if you want and parse the enum so you can pass a string.

David Elizondo | LLBLGen Support Team
Posts: 24
Joined: 19-Feb-2007
# Posted on: 27-Oct-2009 05:02:26   

sweet ! thankssmile