New Posts New Posts RSS Feed: Predicate description and typeof()
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Predicate description and typeof()

 Post Reply Post Reply
Author
sarmaad View Drop Down
Newbie
Newbie


Joined: 18-Jul-2010
Location: Sydney
Posts: 15
Post Options Post Options   Quote sarmaad Quote  Post ReplyReply Direct Link To This Post Topic: Predicate description and typeof()
    Posted: 30-Jun-2011 at 2:27am
Hi,

I am building query from IPredicateDescription s using PredicateBuilder.And and PredicateBuilder.Or methods. 

The case is like this:


I've got a pizza menu, with different pizza classes (PepperoniPizza, etc) deriving from Pizza.

Let's assume that each order has one pizza connected and that pizza is represented by order.pizza field of type Pizza in db.

I would like to construct a predicate like this:

select every order that (order.pizza istypeof (PepperoniPizza))

How can I do it, so that I would be able to combine it with other predicates?
Back to Top
robertg View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 15-Mar-2011
Location: California
Posts: 87
Post Options Post Options   Quote robertg Quote  Post ReplyReply Direct Link To This Post Posted: 30-Jun-2011 at 5:06pm
You're deriving your pizza classes from single-table inheritance in EF? If so, you should be able to query with something like mgr.ParentEntity.OfType<ChildEntity>();.Otherwise, how are you storing this data, and how are you differenciating between different kinds of pizza? Could you provide me with some more information on how you're organizing and accessing your data?
 
Thanks.


Edited by robertg - 30-Jun-2011 at 5:42pm
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down