Retrieving Predicate from EntityRelation

Posts   
 
    
Nazanin
User
Posts: 5
Joined: 13-Jan-2010
# Posted on: 13-Jan-2010 08:20:40   

Hi,

I have to retrieve the predicate form entityRelation.

I mean if I have an EntityRelation joining table T1 to T2 on T1.a = T2.b, How can I get this map (T1.a = T2.b) from it later?

There are some methods in IEntityRelation which return PK fields or FK fields, but I couldn't find which PK field has been mapped to which FK field. disappointed

could u please help me? Thanx Nazanin

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 13-Jan-2010 09:57:42   

I think you should use their order. i.e. first FK is mapped to first PK..... etc.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39863
Joined: 17-Aug-2003
# Posted on: 13-Jan-2010 10:28:12   

Walaa is right, the order is identical, so PK field at index x is related to FK field at index x.

Frans Bouma | Lead developer LLBLGen Pro
Nazanin
User
Posts: 5
Joined: 13-Jan-2010
# Posted on: 13-Jan-2010 12:23:31   

Walaa wrote:

I think you should use their order. i.e. first FK is mapped to first PK..... etc.

frowning But it's not a good method!!!

Any way! thanx alot! smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39863
Joined: 17-Aug-2003
# Posted on: 13-Jan-2010 12:26:39   

Nazanin wrote:

Walaa wrote:

I think you should use their order. i.e. first FK is mapped to first PK..... etc.

frowning But it's not a good method!!!

Any way! thanx alot! smile

Not a good method? the fields are stored in sets, so the index is crucial. Sure, we could have stored them in 'pairs', but this was easier simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Nazanin
User
Posts: 5
Joined: 13-Jan-2010
# Posted on: 13-Jan-2010 14:54:02   

But, what about Predicate? For example, how can I know what ComparisonOperator had been used? You know, we can have T1 join T2 on T1.x > T2.x or T1 join T2 on T1.X != T2.x

I mean, with having just a pair, how can I know what the relation really was??? frowning

It's confusing!!

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 13-Jan-2010 15:08:02   

AFAIK, in database relations only equals are used: FK = PK.

Nazanin
User
Posts: 5
Joined: 13-Jan-2010
# Posted on: 13-Jan-2010 15:32:45   

Walaa wrote:

AFAIK, in database relations only equals are used: FK = PK.

So we cannot have any other comparison (like in theory) in entityRelation.

Thanx alot smile