How to add filter for custom property

Posts   
 
    
Viresh
User
Posts: 31
Joined: 28-Jan-2008
# Posted on: 02-Sep-2008 11:03:59   

Hi,

I'm having one custom property (e.g. IsCompleted) in entity class (e.g. Job entity) written between custom entity code. I want to add filter on this condition. How can I achieve that? I want to do something like:

filter.PredicateExpression.Add(IsCompleted==true);

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 02-Sep-2008 11:15:46   
filter.PredicateExpression.Add(new EntityProperty("IsCompleted") == true);
Viresh
User
Posts: 31
Joined: 28-Jan-2008
# Posted on: 02-Sep-2008 11:37:37   

Thanks walaa for yr reply. But it's complaining about type cast. Can't figure out what it accepts?

Unable to cast object of type 'SD.LLBLGen.Pro.ORMSupportClasses.EntityProperty' to type 'SD.LLBLGen.Pro.ORMSupportClasses.IEntityField2'.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 02-Sep-2008 12:18:35   

If you are trying to filter on the database side on an entity property that's not mapped to a database field, this won't work. But rathe you should filter on the client side an EntityView.

Viresh
User
Posts: 31
Joined: 28-Jan-2008
# Posted on: 02-Sep-2008 12:47:24   

You're right. It's a user defined property which is not mapped with database field.

I achieved that using EntityView. Thanks Walaa.