Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Designer> How to create a 1:1 relation
 

Pages: 1
Designer
How to create a 1:1 relation
Page:1/1 

  Print all messages in this thread  
Poster Message
ww
User



Location:

Joined on:
01-Oct-2004 22:58:25
Posted:
65 posts
# Posted on: 06-May-2009 18:34:29.  
How do you create a 1:1 relation in the designer?

I have a Customer table and a CustomerStats stats table that should be in a 1:1 relationship. They can't share the same PK because each inherits from a common base class, using the Target-Per-Entity model. So instead either the Customer has an FK to the CustomerStats or vice-versa. In llblgen this results in an 1:N relation on one side, which is cumbersome: if Customer has an FK to CustomerStats, CustomerStats has a "Customers" collection rather than a single Customer, so I have to do a collection fetch and take the first member. Is there a way to tell the designer to make this a 1:1 relation?
  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8065 posts
# Posted on: 07-May-2009 05:47:48.  
You need to place a unique constraint on the relevant connected field of the FK side.

David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
ww
User



Location:

Joined on:
01-Oct-2004 22:58:25
Posted:
65 posts
# Posted on: 07-May-2009 15:27:26.  
Excellent. Thanks.
  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.