Non PK||FK Relations

Posts   
 
    
Posts: 3
Joined: 07-Jul-2006
# Posted on: 11-Jul-2006 08:23:49   

Is it possible to map relations between non PK||FK table fields?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 11-Jul-2006 09:47:32   

No. So either specify a field as the PK (if there's no pk yet) or construct the EntityRelation object in code. Though you then don't have a field mapped onto it of course.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 3
Joined: 07-Jul-2006
# Posted on: 11-Jul-2006 09:54:27   

Where can I find examples of constructing EntityRelation in code?

I am dealing with a legacy datamodel (200 tables, 8 years old) that used natural keys and people have added new keys without updating the primary key due to the cascading effect of the natural keys in other tables.

We are in the process of fixing these key errors, but I was hoping to find a way to create relations based on these new keys until we finish refactoring the datamodel.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 11-Jul-2006 11:08:26   

I then think it's best if you use a surrogate schema: create a new schema / catalog on the system without any data, but with the tables as they are in the real schema and define there the RIGHT PK's and FK's. Then create a project on that schema/catalog and generate code with that.

Then in your vs.net project, use catalog/schema name overwriting at runtime (see the llblgen pro documentation: "Application configuration through .config files") to target the real schema/catalog.

Frans Bouma | Lead developer LLBLGen Pro