title: Get Auto Identity Key after Insert via EF
body: <p>Is there a straight forward way of retrieving a DB auto generated primary key when adding a record via Entity Framework 4.1? </p>
  
  <p>For example:</p>
  
  <pre><code>dbcontext.Entity_Tables.Add(new Entity_Table { item1 = val1, item2 = val2 });
  dbcontext.SaveChanges();
  newPK = ???;
  </code></pre>
  
  <p>The SQL equivalent would be:</p>
  
  <pre><code>newPK = executeOnDB("INSERT INTO Entity_Table (item1, item2) VALUES (val1, val2);SELECT @@Indentity";);
  </code></pre>
  
  <p>BTW I'm using MySQL but the SQL would be the same as on MSSQL</p>