title: Order by Collection entity property in ASP.NET MVC 3 (entity framework)
body: <p>I have two entities like:</p>
  
  <pre><code>public class Employee
  {
      public int Id { get; set; }
  
      public string Name { get; set; }
      public string Lastname { get; set; }
  
      public virtual ICollection&lt;EmployeeEducation&gt; EducationList { get; set; }
  }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>public class EmployeeEducation
  {
      public int Id { get; set; }
  
      public int EmployeeId { get; set; }
  
      public int Type { get; set; }
  
      [ForeignKey("EmployeeId")]
      public virtual Employee Employee { get; set; }
  
  }
  </code></pre>
  
  <p>My question is, how can I get a specific employee and this employee's education list ordered by <strong>Type</strong> property?</p>
  
  <p>I have tried:</p>
  
  <pre><code>Employee employee = _work.EmployeeRepository.GetSet()
      .SelectMany(e =&gt; e.EducationList, (e,d) =&gt; new { e, d })
          .OrderBy(x =&gt; x.d.Type)
          .Select(x =&gt; x.e)
     .FirstOrDefault(e =&gt; e.Id == id);
  </code></pre>
  
  <p>But it does't seem to be sorting. What is the correct way to do this?</p>
  
  <p>Thanks for everyone...</p>