title: C# mvc How to set AutoIncrement on
body: <p>Hi I am trying to create a new customer record. The primary id customerid is autoincremental column.</p>
  
  <p>When I try to insert a new record I get this error :</p>
  
  <p><strong>Message=Cannot insert explicit value for identity column in table 'Customer' when IDENTITY_INSERT is set to OFF.</strong></p>
  
  <p>This is the same code I am using :</p>
  
  <pre><code>NewCustomer.Name= user.Name;
  NewCustomer.Address= user.Address;
  NewCustomer.Phone = user.Phone;
  NewCustomer.Email= user.Email;
  
  db.Customers.Add(NewCustomer);
  db.SaveChanges();
  </code></pre>
  
  <p>I read somewhere that I have to set  autoincrement on, but I am using entity framework and not any direct sql.
  Can some one please help how I could turn on autoincrement so I could insert records?</p>