Prefetch On Custom Relation Via Unique Constraint Foreign Key

Posts   
 
    
pcoulter
User
Posts: 14
Joined: 11-Nov-2004
# Posted on: 14-Dec-2006 00:28:37   

OK, I think I got everything summarized in that subject line. Here's the situation: I've got two fields in TableA that make up a unique constraint. They are then used as a foreign key in TableB. This foreign key does not generate a relation in LLBLGen, because it doesn't involve a primary key. I'd like to be able to get a collection of TableBEntity and prefetch the TableAEntity that is related via the foreign key tied to the unique constraint.

I'm using Sql Server 2005 and adapter.

Is this even possible?

Thanks.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 14-Dec-2006 06:15:14   

This would be possible if you use the LLBLGen Pro Designer to set those couple of fields as the PK of the entity.

pcoulter
User
Posts: 14
Joined: 11-Nov-2004
# Posted on: 02-Jan-2007 19:24:47   

I'm having a hard time figuring out how to use the designer to make those fields the primary key. Can you point me in the right direction?

Thanks, Pete

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 03-Jan-2007 01:05:57   

The fields must not be nullable. Then you should be able to edit the Entity TableA and set that the two fields are Part of the Primary Key. This can be set at the bottom of the Entity Fields tab.