[FIXED/SOLVED] Order of Tables in Typed List

Posts   
 
    
DaveR
User
Posts: 43
Joined: 15-Jun-2004
# Posted on: 12-Jul-2004 15:25:58   

I have two tables with a common field that have a 1:n relation in one direction, and an m:1 relation in the other direction. I want a typed list that obeys weak relations, and therefore want to use the 1:n relation. However, when I add the tables to the TL, the order is changed so that it always chooses the m:1 relation; no matter how I add the tables, I cannot get the n:1 relation.

The strange thing is, I have another table that is nearly identical except for one field, with the same relations, and for this table I can get the 1:n relation. For example:

UserKey
-----------
UserKeyID (PK)
CustomerID (FK to Customer)
KeyID (FK to Key)
Value

SystemKey
--------------
SystemKeyID (PK)
LocationID (FK to Location which is a child of Customer)
KeyID (FK to Key)
Value

Key
-----
KeyID (PK)
Description
DefaultValue

When I build a TL with UserKey and Key, I can get the 1:n relation for Key:UserKey. But when I build a TL with SystemKey and Key, I can only get the m:1 relation for SystemKey:Key.

I don't really understand why the LLBLGen GUI behaves differently in these two cases. Nevertheless, at this point it seems my only option is to modify the generated code, or derive a class from it and override the GetRelationInfo() method.

Any other advice would be appreciated.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 12-Jul-2004 15:47:01   

If you add Key first and then SystemKey, you get the relation SystemKey - Key ? (which to me seems impossible, but just to be sure simple_smile )

(another question: do you use the 1.0.2003.1 designer or the 1.0.2004.1 designer?)

Frans Bouma | Lead developer LLBLGen Pro
DaveR
User
Posts: 43
Joined: 15-Jun-2004
# Posted on: 12-Jul-2004 16:02:28   

Sorry, I realize my TL is a bit more complex. There is an additional KeyGroup table, and the Key table has an FK to it:

Key
-----
KeyID
KeyGroupID (FK to KeyGroup)
Description
DefaultValue


KeyGroup
------------
KeyGroupID (PK)
Description

I add Key first, then SystemKey, and everything is fine. But once I add KeyGroup, it switches the order of the tables and I can no longer get the 1:n Key:SystemKey relation.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 12-Jul-2004 16:16:18   

But which designer version are you using? simple_smile

If I reproduce it with entities looking the same (OrderEntity (key) Customer (Keygroup), orderdetails (systemkey), and I thus add order first, then orderdetails, then customer, I get: order - Orderdetails order - customer,

as expected.

Relations are also not reshuffled, when an entity is added, it searches for a relation to use. The entity added is always at the END of such a relation. It checks with all the entities and when it finds one it uses that one (initially). v1.0.2004.1 has improved 'alternative' findings, so you can select an alternative IF there is one. In your case, there isn't, once you start adding the entities in a given order.

(alternative can be f.e. when you have customer - Address which exists twice)

So I'm a but puzzled here simple_smile If you're on 1.0.2004.1, and with a new TL you get the same behavior over and over again, please mail me the .lgp file at: support@llblgen.com and I'll check it out in the debugger. All .lgp files are destroyed after testing for the issues and are treated confidential.

Frans Bouma | Lead developer LLBLGen Pro
DaveR
User
Posts: 43
Joined: 15-Jun-2004
# Posted on: 12-Jul-2004 16:32:23   

I was not using v1.0.2004.1. I will download it now.

Thanks very much for your prompt response. If I have further problems with the new version, I'll contact you directly.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 12-Jul-2004 16:42:42   

Ok, be sure to apply the hotfix as well (released july 10th). This is rolled into the installer very soon.

Frans Bouma | Lead developer LLBLGen Pro