title: Entity Framework Identity Column Negative Value
body: <p>I have an ASP.NET Core 1.0 web application that implements some REST web services which interact with a PostgreSQL database via Entity Framework Core.</p>
  
  <p>In my model, I have a variety of code-first entity classes that utilize the following pattern:</p>
  
  <pre><code>[Key]
  [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
  public int Id { get; set; }
  </code></pre>
  
  <p>Obviously this corresponds to an auto-incrementing unique key identity column in the database.</p>
  
  <p>The trouble is that, undoubtedly due to some defect somewhere, occasionally for reasons I don't yet understand, the value of the Id is a very large negative integer.</p>
  
  <pre><code>-2147482645
  </code></pre>
  
  <p>Normally, they are well-behaved nicely ascending integer values starting at 1.</p>
  
  <p>What could be causing it?</p>