Predicate and PredicateExpression

Posts   
 
    
Andrius
User
Posts: 68
Joined: 04-Apr-2005
# Posted on: 24-Feb-2006 15:02:16   

I really liked operator overloading in version 1.0.2005.1

But for example why it is required to type :


bucket.Relations.Add(CustomerEntity.Relations.OperationalSiteEntityUsingOperationalSiteID)
                .CustomFilter = new PredicateExpression(OperationalSiteFields.OperationalSiteID == OrderFields.OperationalSiteID);

instead of


bucket.Relations.Add(CustomerEntity.Relations.OperationalSiteEntityUsingOperationalSiteID)
                .CustomFilter = (OperationalSiteFields.OperationalSiteID == orderFields.OperationalSiteID);

This generates an error that Predicate could not be converted to PredicateExpression

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39930
Joined: 17-Aug-2003
# Posted on: 24-Feb-2006 15:41:40   

Because the operator creates an IPredicate instance, (like FieldCompareValuePredicate), and CustomFilter requires a PredicateExpression, which is a subtype of Predicate.

Frans Bouma | Lead developer LLBLGen Pro
Andrius
User
Posts: 68
Joined: 04-Apr-2005
# Posted on: 24-Feb-2006 15:50:15   

Otis wrote:

Because the operator creates an IPredicate instance, (like FieldCompareValuePredicate), and CustomFilter requires a PredicateExpression, which is a subtype of Predicate.

I know that. Could Custom filter require Predicate?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39930
Joined: 17-Aug-2003
# Posted on: 24-Feb-2006 17:03:25   

It's a property, so it can just have 1 type. To make it a predicate gives problems for code which reads this property. (3rd party code), and that would therefore break. I don't see an advantage in making this property of IPredicate type.

Frans Bouma | Lead developer LLBLGen Pro