title: Does DbContext.SaveChanges() insert new records in the order they were added to DbSet?
body: <p>My question assumes simple inserts into a table with no relevant relations.</p>
  
  <pre><code>// various unrelated operations w/context...
  var one = new DbRecord();
  var two = new DbRecord();
  var thr = new DbRecord();
  context.DbRecords.Add(one);
  context.DbRecords.Add(two);
  context.DbRecords.Add(thr);
  // various unrelated operations w/context...
  context.SaveChanges();
  </code></pre>
  
  <p>In this case, will my DbRecord entities <em>always</em> be inserted in the order I added them to the DbSet? They seem to be in my testing, but can I rely on this?</p>
  
  <p>"various unrelated operations" refers to operations on different, not-related DbSets of the same context; inserts, deletes, and updated entities (POCOs, in my case)</p>
  
  <p>I want them to be inserted in exact order so I can use the pk/identity field to sort by, yet I also need to take advantage of the implicit transaction that the context provides around my context.SaveChanges(). Although the other operations are not related as far as the database schema is concerned, the entries themselves are essentially log entries about the updates being performed, and their order is critical.</p>
  
  <p>If the context does not guarantee inserting the records in the same order, I will have to add a datetime field to the records, and handle rolling back myself.</p>