Print Page | Close Window

Predicate description and typeof()

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2804
Printed Date: 02-Apr-2025 at 6:18am


Topic: Predicate description and typeof()
Posted By: sarmaad
Subject: Predicate description and typeof()
Date 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?



Replies:
Posted By: robertg
Date 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.



Print Page | Close Window