[SOLVED] 1:1 relation without unique constraint

Posts   
 
    
philippe
User
Posts: 6
Joined: 19-Nov-2004
# Posted on: 24-Nov-2004 16:10:52   

There is a known problem in SQL Server concerning unique constraints: it's not possible to create a unique constraint for a field which can hold multiple NULL values, even if all non-NULL values are unique. This is possible in Oracle.

Since LLBLGen Pro only looks if there is a unique constraint to determine if a relation is 1:1 or n:1, there is no way to create a 1:1 relation when needed.

For example, I have 2 tables: Product and Testsheet

"Product" records have a field "TestSheetID" (PK of Testsheet), but some products don't have a corresponding testsheet. This is actually a 1: (0,1) relation...

It would be nice to be able to do this in code:

ProductEntity myProduct = new ProductEntity(id);

if (myProduct.Testsheet != null)
{
   // do something with the testsheet record
}

The point is: is it possible to force a relation to be 1:1 in LLBLGen Pro ?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39897
Joined: 17-Aug-2003
# Posted on: 24-Nov-2004 16:16:44   

Not at the moment. Planned is a feature to mark a field 'unique' (or a set of fields) so you could mark a field (or set of fields) unique in the designer and then use that to define relations.

Frans Bouma | Lead developer LLBLGen Pro
philippe
User
Posts: 6
Joined: 19-Nov-2004
# Posted on: 24-Nov-2004 16:28:39   

Thanks! I look forward to it. That would be a big help.