title: Linq query to return all records with select new statement
body: <p>I have table teacher and table student, for each record in table 'teacher' will have more than one record in table 'student'. Here is my model class</p>
  
  <pre><code>public class Test
  {
      public int Id { get; set; }
      public string Text { get; set; }
      public List&lt;StudentsDTO&gt; Students{ get; set; } 
  }
  </code></pre>
  
  <p>here is my linq query am trying to get the records</p>
  
  <pre><code>     var st = (from tt in context.Teachers
                                      join ss in context.Students
                                      on tt.ID equals ss.teacherID
                                      where tt.TypeID == 2
                                      select new Test
                                      {
                                          Id = tt.ID,
                                          Text = tt.Text,
                                          Students= new List&lt;StudentsDTO&gt;()
                                          {
                                              new StudentsDTO()
                                              {
                                                  Name= ss.Name,
                                                  Id= ss.StudentID
                                              }
                                          }.ToList()
                                      }).ToList();
              return st;
  </code></pre>
  
  <p>am not able to get collection of students for each record in teachers table,how to do this?</p>