Confused about GetRelationInfo code

Posts   
 
    
Posts: 33
Joined: 31-May-2005
# Posted on: 22-Jun-2005 21:47:47   

We're a little confused with the GetRelationInfo method of an Entity, particularly with the naming scheme.

For example, we have a table defined as:


CREATE TABLE order
(
  id        INTEGER PRIMARY KEY,
  first_contact_id INTEGER REFERENCES contact(id),
  second_contact_id  INTEGER REFERENCES contact(id)
  third_order_detail_id  INTEGER REFERENCES contact(id)
)

However, whenever we try to retrieve an EntityCollection from the contact table, we are presented with 3 methods: OrderEntity.GetRelationInfoContact() OrderEntity.GetRelationInfoContact() OrderEntity.GetRelationInfoContact_()

The only way we can tell the 3 apart is to look back in the EntityClasses source code. Is there an easier way? The underscore logic seems to be used in multiple areas, and since we have lots of tables with multiple references to the same table like above, the code is rather confusing.

Thank you, Josh Lindenmuth

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 22-Jun-2005 22:08:24   

You can rename these fields mapped onto relations in the llblgen pro designer (using the project explorer or editing the entity in the entity editor) to something more useful.

You can also (starting in 1.0.2004.2) specify patterns to construct these names. This avoids getting a lot of underscores.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 33
Joined: 31-May-2005
# Posted on: 22-Jun-2005 22:21:42   

Dumb question ... how can I setup these patterns in 1.0.2004.2? That's the version I'm using (downloaded today), but I can't find how to perform the setup.

thx, josh

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 22-Jun-2005 22:39:28   

JoshLindenmuth wrote:

Dumb question ... how can I setup these patterns in 1.0.2004.2? That's the version I'm using (downloaded today), but I can't find how to perform the setup.

thx, josh

In the preferences (and these are copied into a new project, so if you want to use these patterns in your current project, alter them in the project properties as well).

File -> preferences. and then under 'name construction'. simple_smile

These patterns are performed on new entities. So your existing entities, either remove them, add them again or manipulate the names by hand.

The underscore you're running into is caused by a 1:1 relation I pressume? You then should add for example {$StartEntityFieldNames} to the pattern, which will create unique names.

Frans Bouma | Lead developer LLBLGen Pro