Building a predicate

Posts   
 
    
colm
User
Posts: 13
Joined: 16-Jun-2006
# Posted on: 20-Jun-2006 12:11:44   

I'm trying to build up a predicate that can work on multiple tables, where I have a particular entity.

The code I tried was:

IRelationPredicateBucket predicatePreviousEntity = new RelationPredicateBucket((entity.Fields["parentId"] == entity.Id));

Which it doesn't seem to like. What is the equivalent which would work?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 20-Jun-2006 13:01:27   

The field indexer returns an IEntityField2, you should do:

IRelationPredicateBucket predicatePreviousEntity = new RelationPredicateBucket((((EntityField2)entity.Fields["parentId"]) == entity.Id));

Frans Bouma | Lead developer LLBLGen Pro
colm
User
Posts: 13
Joined: 16-Jun-2006
# Posted on: 20-Jun-2006 13:12:10   

Fantastic, thankyou! I knew that it'd be something easy that'd make me feel like an idiot simple_smile

Brilliant product, btw.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 20-Jun-2006 13:46:53   

smile

Frans Bouma | Lead developer LLBLGen Pro