Strong Underscores in generated code?

Posts   
 
    
csmith12
User
Posts: 33
Joined: 08-Dec-2003
# Posted on: 15-Dec-2004 16:18:04   

Have a look at the image at this link

I am seeing some of the objects and methods get duped with a "_" or multiple underscores after them. I am not sure what is going on. Is this a bug, or something I am doing incorrectly?

I am using LLBLgGen Pro Versio0n 1.0.2003.1 April 30, 2004

Thanks for any help.

Marcus avatar
Marcus
User
Posts: 747
Joined: 23-Apr-2004
# Posted on: 15-Dec-2004 16:22:24   

This is happening because 2 or more related entities end up with the same name. The desginer appends one or more "_"s in order to avoid name conflicts.

I usually rename most of my related entities and collections to more menaingful names anyway. simple_smile (You have to rename them in the Designer before the code is generated)

csmith12
User
Posts: 33
Joined: 08-Dec-2003
# Posted on: 15-Dec-2004 16:39:01   

Not sure how that can be happening, but let me ask this then.

I have table A and table B, one to many relationship. I also have table C with many to one with both A and B. Could this be creating the kinds of dupe names that I am seeing?

Marcus avatar
Marcus
User
Posts: 747
Joined: 23-Apr-2004
# Posted on: 15-Dec-2004 16:50:44   

csmith12 wrote:

Not sure how that can be happening, but let me ask this then.

I have table A and table B, one to many relationship. I also have table C with many to one with both A and B. Could this be creating the kinds of dupe names that I am seeing?

It's more like:

Company CompanyID SalesPersonID DeveloperID CompanyName

Person PersonID PersonName

SalesPersonID and DeveloperID are both related to PersonID in a ManyToOne

The generator will generate fields based on Relations for you, but these will be called: "Person" (related via SalesPersonID) & "Person_" (related via DeveloperID) because both fields related to the Person table.

You then have to manually go in to the Designer (Edit Entity, Fields Mapped on Relations tab) and change "Person" to SalesPerson and "Person_" to Developer BEFORE you generate the code.

On the other side (in Person Entity) you will see:

Company and Company_ from the OneToMany opposite relationship...

Hope this helps!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 15-Dec-2004 17:12:23   

These names, as Marcus explains, result in duplicates otherwise so the '_' is appended. The current naming scheme simply uses the related entity name and this can lead to a lot of duplicate names if a lot of m:n relations pop up for example. (most of these duplicates are from m:n relations).

You can either rename them to names with more meaning or hide them (selfservicing requires that you hide both sides), which can be done in the designer.

Currently in development is a more sophisticated naming scheme which should result in less duplicates.

Frans Bouma | Lead developer LLBLGen Pro
csmith12
User
Posts: 33
Joined: 08-Dec-2003
# Posted on: 15-Dec-2004 18:39:19   

Yes, I see now. Thanks for further in depth coverage.