Question toward the automatic naming of entity collections

Posts   
 
    
kbjorn
User
Posts: 13
Joined: 10-May-2005
# Posted on: 10-May-2005 22:37:11   

I have been using LLBLGen for some months now, and I'm impressed and quite thrilled with the results I'm getting, but from day one, I was somewhat anxious, that this automatic code generation will end up with me chasing bugs in my production application. This hasn't happend to me yet though simple_smile

Anyway - here is an example:

I have an Entity with many relations, and this Entity has collections named Company, Company, Company_ and Company___

Let's say I accidentially remove the FK related to the Collection Company__ (two underscores) and refreshes catalogue. After discovering the error of the removed FK and inserting it again in the DB (here comes the question):

How will LLBLGen respond? confused

Is there a built in mechanism to preserve correct naming of collections, or must the database designer be extremely cautious when working with FK's?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 11-May-2005 10:07:04   

kbjorn wrote:

I have been using LLBLGen for some months now, and I'm impressed and quite thrilled with the results I'm getting, but from day one, I was somewhat anxious, that this automatic code generation will end up with me chasing bugs in my production application. This hasn't happend to me yet though simple_smile

simple_smile

Anyway - here is an example:

I have an Entity with many relations, and this Entity has collections named Company, Company, Company_ and Company___

Let's say I accidentially remove the FK related to the Collection Company__ (two underscores) and refreshes catalogue. After discovering the error of the removed FK and inserting it again in the DB (here comes the question):

How will LLBLGen respond? confused

It will rebuild all relations after a refresh. It then tries to find back for each existing relation the new relation and migrates that existing relation to the new relation. So I think the relation with Company__ will be migrated to the new relation on the new FK and the name Company__ will be migrated too.

Is there a built in mechanism to preserve correct naming of collections, or must the database designer be extremely cautious when working with FK's?

The '' appends are done to make sure the name is unique. Most of them, if you have a long list of the same name with '', are m:n relations. You can either decide to hide them, or rename them. (hide them all at once in the entity editor). The name a field mapped onto a relation has, is preserved during a refresh, as long as the relation still exists in the catalog. If not, the name is not preserved. So if you first have it, then remove the FK from the db, refresh, (it's gone in the project now), then re-add the FK, then refresh again, the name will be re-created.

Starting in 1.0.2004.2, you can specify patterns for the names for fields mapped onto relations. These patterns often result in no duplicate names so the problem will go away.

Frans Bouma | Lead developer LLBLGen Pro
kbjorn
User
Posts: 13
Joined: 10-May-2005
# Posted on: 12-May-2005 20:46:46   

Well, it seems that this factor has been thought through too.

Thank you for your quick reply.