title: LINQ OrderBy Name ThenBy ChildrenCollection.Name
body: <p>Is there any way in LINQ to do an OrderBy and then do a ThenBy with the ThenBy using the children of the parent object to do the secondary ordering?</p>
  
  <pre><code>_repository.GetActiveDepartmentGroupsWithDepartments().OrderBy(c =&gt; c.DepartmentGroupName).ThenBy(c =&gt; c.Departments.OrderBy(d =&gt; d.DepartmentName))
  </code></pre>
  
  <p>In the above case, c.Departments is an EntityCollection.</p>
  
  <p>BTW: When I try the above and then do a ToList() on it, I get this error: </p>
  
  <pre><code>DbSortClause expressions must have a type that is order comparable.
  Parameter name: key
  </code></pre>
  
  <p>Thanks in advance for any help or guidance.</p>