title: Bulk insert records and get their Id's after bulk insert in Entity Framework
body: <p>I want to bulk insert 100,000+ rows into a table (which has a identity column which auto increments every time a new row is inserted).</p>
  
  <ol>
  <li><p>What would be the fastest way to insert the rows with least performance impact?</p></li>
  <li><p>After all rows are inserted, how do I get the list of ids of the rows that are recently inserted?</p></li>
  </ol>
  
  <p>Note: I did the following but I did not get the list of ids</p>
  
  <pre><code>ctx.Documents.AddRange(documentsList);
  ctx.SaveChanges();
  
  var ids = documentsList.Select(d =&gt; d.Id);
  </code></pre>
  
  <p>Thanks</p>