Hi All,
Trying to use Linq with some Entity objects to do a crafty query here. Hoping for some help with a point I'm having a hard time finding decent documentation on:
Basically, I'm trying to use OrderBy to order against the child of an object I'm querying against. The difficult part is that the object has multiple children, and based on the object's type, I need to use one set of a children or another set of children to order by.
To clarify:
A can come in two types: i, or ii
If A is of type i, then I need to order by D: i.e, A has a B, which has many Cs, which has many Ds.
If A is of type ii, then I need to order by F: ie. A has an E, which has many Fs.
So the question is, how can I order by D and F, from A?
I'm hoping for something like:
IQueryable<AObject> aObj = query.OrderBy(aObject=> aObject.Type==i? aObject.B.C.D : aObject.E.F).Skip(offset).Take(limit).AsQueryable();
Of course, I'm also just confused as to how to order the D's, when C has a collection of Ds
Thoughts? And thanks in advance!