title: Entity Framework 5 : Get Auto_Increment value before insert
body: <p>I currently have a table as defined as follows:</p>
  
  <pre><code>CREATE TABLE ( 
      ID int identity(1,1) primary key not null,
      field_one nvarchar(max) not null
  )
  </code></pre>
  
  <p>I am using Entity framework 5 to insert records into this table. This aspect works and I am inserting records correctly. </p>
  
  <p>field_one is a value based on the current id. For example if I have records where the max ID is 5, the next record would be inserted as (6,ABC6), and then (7, ABC7) and so on.</p>
  
  <p>What I am running into is when the table is empty. The identity is at 7, and so the next record should be (8,ABC8). I Need to get the id of the auto_increment prior to the insert in order for me to apply the calculations I need when the table is empty.</p>
  
  <p>How would I be able to do this since I know that the id is generated after the insert and the property is in my entity gets updated after.</p>