Retrieve all Entities in DAL

Posts   
 
    
Nav
User
Posts: 9
Joined: 12-Jan-2009
# Posted on: 23-Jan-2009 21:38:38   

Is there a way to retrieve (through code) all the Entities for an llblgen generated DAL?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 24-Jan-2009 02:13:34   

Try this:

foreach (string entity in Enum.GetNames(typeof(EntityType)))
{
    Console.WriteLine(entity); 
}
David Elizondo | LLBLGen Support Team
Nav
User
Posts: 9
Joined: 12-Jan-2009
# Posted on: 26-Jan-2009 17:28:13   

that worked. Thank you.

I have another question. How Can I find the relations for each entity (through code) in Enum.

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 26-Jan-2009 17:49:14   
Nav
User
Posts: 9
Joined: 12-Jan-2009
# Posted on: 26-Jan-2009 18:44:44   

I am new to using llblgen so be bear with me. I am using self servicing.

Although last thread does mention it, but i am having hard time understanding how and where and what code is needed to get the entity relations (list of entities which are related) to an entity.

Could please explain bit more and give an example to simplify things for me.

Thank you..

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 27-Jan-2009 03:25:00   

Hello Nav,

Since v2.5 IEntity(2) and EntityBase(2), and thus all entity instances now have a method called GetAllRelations() which will return a list of all **EntityRelation **objects the entity has (except the hierarchy relations). simple_smile

The snippet:

CustomerEntity customer = new CustomerEntity();
// or... IEntity customer = new CustomerEntity();

// get the relations info
foreach (IEntityRelation r in customer.GetAllRelations())
{
    // do what you have to do with 'r'
}
David Elizondo | LLBLGen Support Team
Nav
User
Posts: 9
Joined: 12-Jan-2009
# Posted on: 28-Jan-2009 00:09:21   

Thank you