Entity Framework 4 / Linq: How to OrderBy() a hierarchical Entity? -


i have viewmodel carved several entity relations:

products[].prices[].others[].myfield 

how order products[] nested myfield? when clause, it's this:

products.where( p => p.prices.any( q => q.others.any( r => r.myfield == 4))); 

so if wanted products.orderby() , order myfield, expression like?

products.orderby( p => p.prices.selectmany( ?? 

as have several prices below product need select 1 sort on, like

products.orderby( p => p.prices.first().others.first().myfield ) 

or if want order highest price

products.orderby( p => p.prices.orderbydescending(price => price.value).first().others.first().myfield ) 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -