EF OrderBy method doesn't work with joins

Posted by dudeNumber4 on Stack Overflow See other posts from Stack Overflow or by dudeNumber4
Published on 2010-06-18T15:19:15Z Indexed on 2010/06/18 15:33 UTC
Read the original article Hit count: 533

Filed under:

Following works (ordered by name):
from t in context.Table1.OrderBy( "it.Name" ) select t

This doesn't work (no ordering):
from t in context.Table1.OrderBy( "it.Name" )
join t2 in context.Table2 on t.SomeId equals t2.SomeId select t

Nor does this (trying to reference the parent table to order):
from t in context.Table1
join t2 in context.Table2.OrderBy( "it.Table1.Name" ) on t.SomeId equals t2.SomeId select t

Nor does this (trying to order on the child table):
from t in context.Table1
join t2 in context.Table2.OrderBy( "it.ChildName" ) on t.SomeId equals t2.SomeId select t

How do I cause OrderBy not to be ignored while joining?

© Stack Overflow or respective owner

Related posts about entity-framework