title: Entity Framework identity column always zero
body: <p>I'm using following class to insert products to database.
  ID column is primary key.
  After adding multiple products to db context (without calling savechanges method) all newly added rows identity columns are zero! </p>
  
  <p>My scene...
  User adds several products and browse them on the data grid. 
  User selects one product and adds some barcodes to selected product.
  When user finishes the job clicks on save button and application calls SaveChanges method!</p>
  
  <p>When user wants to add some barcodes to products firstly I need to find selected product from context and adds entered barcode text to Barcodes list. But I cant do that because all products identity columns value are the same and they are zero. </p>
  
  <p>How can I solve this problem?</p>
  
  <pre><code>public class Product
  {
      public int ProductID { get; set; }
      public string Code { get; set; }
      public string Name { get; set; }
  
      public virtual List&lt;Barcode&gt; Barcodes { get; set; }
  }
  
  public class Barcode
  {
      public int BarcodeID { get; set; }
      public string BarcodeText { get; set; }
  
      public int ProductID { get; set; }
      public virtual Product Product { get; set; }
  
  }
  </code></pre>