Renaming a table

Posts   
 
    
Pablo
User
Posts: 81
Joined: 21-Mar-2005
# Posted on: 15-Dec-2013 00:32:03   

Hello, I've got a question about renaming a table in the database.

I'm working database first.

In the database I rename a table. In the designer I refresh relational model data from a database In the list of tables I see the new table, but not selected.

I tried the following settings:

File -> Preferences settings: All catalog refresher options to true.

Project -> Settings Section Database First development Both General and Catalog Refresher ... All settings to true

Is there any other setting I should try, which simply makes it work again as it did in 2.6? I would like to see llblgen execute a "refresh" and "generate code" in such a way that it results into a DAL assembly representing targeted database.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 15-Dec-2013 22:01:38   

At Project Settings you should set these two to true:

Sync mapped element names after refresh When set to true, LLBLGen Pro will rename any entity, navigator, typed view, entity field and typed view field if the name of the element they're mapped on has changed, for example a table field was renamed. Setting this option to true can break your own code, so use this option with care. When Sync renamed mapped element names after refresh is set to false, only non-manually changed element names are synced, otherwise all element names are synced. The value Default means the value in the preferences is used.

Sync renamed mapped element names after refresh When set to true (default: false), LLBLGen Pro will sync manually renamed elements after a refresh if Sync mapped element names after refresh is set to true and the name of the element they're mapped on has changed. If Sync mapped element names after refresh is set to false, this setting is ignored. Multiple entities mapped onto the same target will all be resynced in case of a target name change, so use this setting with care. The value Default means the value in the preferences is used.

You didn't mention the LLBLGen version you are using now. Also you said that you set all settings to true. That might not be a good idea.

David Elizondo | LLBLGen Support Team
Pablo
User
Posts: 81
Joined: 21-Mar-2005
# Posted on: 15-Dec-2013 22:31:28   

Version V4.1. Please advise what to do. All I want is to work on the dataabase, and generate a DAL that represents the database. Nothing more, nothing less.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 16-Dec-2013 00:04:31   

Did you try what I said before? (Set those project settings to true, then refresh, then generate code).

David Elizondo | LLBLGen Support Team
Pablo
User
Posts: 81
Joined: 21-Mar-2005
# Posted on: 16-Dec-2013 20:29:51   

Daelmo, thanks for your reply. Yes, the settings are set to true. It simply does not pickup the renewed table without checking it explicitly.

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 17-Dec-2013 00:46:56   

Reproduced. We'll investigate it and get back to you.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 17-Dec-2013 15:47:02   

What Walaa reproduced is below and this is expected:

I have created a simple database with 2 tables. (Category and Product)
Each with 2 identical fields (Id & Name), without any relations.
I created a project in LLBLGen v.4.1, and had both tables in the catalog explorer, but only mapped Product as an entity.
Then went to the database and renamed the product table to ProductX.
Refreshed the catalog, and picked ProductX table (so Category and productx are now selected)
After refreshing, The Product Entity in the project Explorer got mapped to the Category table.
So I guess it picked the first entity it found having the same fields.

This happens because after the refresh the original target of Product isn't found (as it's been renamed). So the engine then tries to find the table back, as it might be renamed (it was). However it doesn't know what the new name is, so it tries to find a table with the same fields as the original. In Walaa's example above, Category is the first table it finds which has the matching fields and which wasn't mapped as an entity before, so it could be the table with the same name, so it picks that one.

I have NO idea if this is the same situation as you run into, because:

In the database I rename a table.
In the designer I refresh relational model data from a database
In the list of tables I see the new table, but not selected. 

that last sentence: what do you mean with 'list of tables' ? The list of tables shown during refresh? I am a bit lost what exactly you want to achieve and what steps you take and which give different results than you expect.

So please post precise steps what you do and what you do expect what should happen and what actually happens.

Frans Bouma | Lead developer LLBLGen Pro