title: Converting ESQL to LINQ to Entities. Sort by related entities
body: <p>I am using EF + RIA and unfortunately meet some problems with sorting by related entities. 
  For such purpose there is ESQL query that I implemented (found only this solution):</p>
  
  <pre><code>var queryESQL = string.Format(
  @" select VALUE ent from SomeEntities as ent 
     join Attributes as ea ON ea.EntityId = ent.Id 
     where ea.AttributeTypeId = @typeId
     order by ea.{0} {1}", columnName, descending ? "desc" : "asc");
  
  var query = ObjectContext.CreateQuery&lt;SomeEntity&gt;(queryESQL, new ObjectParameter("typeId", attributeTypeId));                                                        
  </code></pre>
  
  <p>Tables have following structure:</p>
  
  <pre><code>&lt;Attribute&gt;:
      int Id;
      decimal DecimalColumn;
      string StringColumn;
      int EntityId;
      int AttributeTypeId;
  
  &lt;SomeEntity&gt;:
      int Id;
      string Name;  
  </code></pre>
  
  <p>Is there any way to rewrite this stuff(sorting), using LINQ to Entities approach?</p>