I have a large number of orders.
Each order is of a type.
The types are in a hierarchical tree: there is one master-type and then many branches and layers down of subtypes and sub-types of those and so on.
I want to be able to query the orders by selecting one type and getting back all the orders of this type plus all the orders that are of a subtype of this type (all the way down).
I created a property on the type called IsOfType(Type) in which I check if a type belongs to the branch of certain type.
It works fine. But I have to first get all the orders down to my client before I can use this property in a linq where statement
var ordersOfCertainType = orders.Where(x=>x.Type.IsOfType( typeToBeSelected));
What I would like to do is to use my property in a Entity query i.e.:
manager.GetQuery<Order>.Where(.......) this does not work. Is there a way to get it to work with custom properties?
and if not how would I go about creating a function that runs on the server that does the selection before it sends the resulting orders over the wire.
thank you.