PredicateBuilder "And" Method not working
Posted
by
mikemurf22
on Stack Overflow
See other posts from Stack Overflow
or by mikemurf22
Published on 2011-03-14T21:10:35Z
Indexed on
2011/03/15
16:10 UTC
Read the original article
Hit count: 351
entity-framework
|predicatebuilder
I have downloaded the predicate builder and am having a difficult time getting it to work with the entity framework. Here is my code: v_OrderDetail is the entity
var context = new OrdersEntities();
Expression<Func<v_OrderDetail,bool>> whereClause = w => true;
var predicate = PredicateBuilder.True<v_OrderDetail>();
predicate.And(w => w.Status == "Work");
var results = context.v_OrderDetail.AsExpandable().Where(predicate);
When I look at the results I get back every order. The And predicate doesn't seem to take. When I look at the predicate.parameters.count it only shows 1. I'm not sure, but I would expect it to show 2 after I add the second one.
Any help is greatly appreciated.
© Stack Overflow or respective owner