title: Mapping SQL query result to DTO is not being ordered accordingly
body: <p>Hi I am trying to populate an object from the SQL query result in an ordered way. However, my problem is that the DTO, <em>when it is mapped/populated from the query result, is not ordered the way I have ordered it in my SQL query.</em> </p>
  
  <p>For the simplest example let's say I have 5 records of students in my database. </p>
  
  <p><code>Select Id , Name, Age from Student Order by Name ASC</code> is my <code>GetStudents</code> stored procedure in the database</p>
  
  <p>Then let us say this is the code that actually does the mapping</p>
  
  <pre><code>    var queryResult= conn.GetStudents(); //this is just the conn that calls the stored procedure which is returned as a enumerable list
  
  var myStudentRecord = new StudentsRecord{
  
          TotalRecord = queryResult.ToList().Count(),
  
          //this is not ordered according to the result from SP
          Students = queryResult.Select(result =&gt; new Student
                                       {
                                           Id = result.Id,
                                           Name = result.Name
                                           Age = result.Age
                                       }).ToList()
          }
  </code></pre>
  
  <p>The problem that I have is The <code>StudentsRecord.Students</code> list of student objects are coming back in the same order (in this case ordered by Name <strong>ASC</strong>) regardless of changing the StoredProcedure order by <strong>ASC or DESC</strong></p>
  
  <p><code>StudentsRecord.Students</code> displays a list of </p>
  
  <ol>
  <li>Adam</li>
  <li>Arria</li>
  <li>Asia</li>
  <li>Ben</li>
  <li>Cruz</li>
  </ol>
  
  <p>If I change my stored procedure as <strong>DESC</strong> <code>StudentsRecord.Students</code> ordering stays the same.</p>
  
  <p>I hope I'm making sense here. </p>
  
  <p>Really, I'm just wondering why this is happening. is this framework related? The result set from the query essentially is the same list with just different ordering <strong>ASC or DESC</strong> and obviously it works accordingly when you run the query form the management studio. But when it gets mapped to the object, the list does not reflect the ordering from the result..</p>