title: Can you remove Identity from a primary key with Entity Framework 6?
body: <p>I created a table via entity framework code-first with a primary key set to auto increment, but now I want to remove that auto-incrementing from the column.  I've tried doing that with both fluent API:</p>
  <pre class="lang-cs prettyprint-override"><code>    public class ProductTypeMap: EntityTypeConfiguration&lt;ProductType&gt;
      {
          public ProductTypeMap()
          {
              // This is an enum effectively, so we need fixed IDs
              Property(x =&gt; x.ProductTypeId)
                  .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
          }
  
      }
  </code></pre>
  <p>And an annotation:</p>
  <pre class="lang-cs prettyprint-override"><code>    public class ProductType
      {
          [Required, Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
          public int ProductTypeId { get; set; }
          public string ProductTypeName { get; set; }
  
      }
  </code></pre>
  <p>And in both cases they produce the same migration code:</p>
  <pre class="lang-cs prettyprint-override"><code>    public partial class removeproducttypeidentity : DbMigration
      {
          public override void Up()
          {
              DropPrimaryKey(&quot;dbo.ProductTypes&quot;);
              AlterColumn(&quot;dbo.ProductTypes&quot;, &quot;ProductTypeId&quot;, c =&gt; c.Int(nullable: false));
              AddPrimaryKey(&quot;dbo.ProductTypes&quot;, &quot;ProductTypeId&quot;);
          }
          
          public override void Down()
          {
              DropPrimaryKey(&quot;dbo.ProductTypes&quot;);
              AlterColumn(&quot;dbo.ProductTypes&quot;, &quot;ProductTypeId&quot;, c =&gt; c.Int(nullable: false, identity: true));
              AddPrimaryKey(&quot;dbo.ProductTypes&quot;, &quot;ProductTypeId&quot;);
          }
      }
  </code></pre>
  <p>However, when I run that migration on the database, the Identity Specification is not removed from the SQL Server 2008 database table?</p>
  <p>I also tried explicitly turning off the Identity in the migration as follows, but that didn't do it either:</p>
  <pre class="lang-cs prettyprint-override"><code>AlterColumn(&quot;dbo.ProductTypes&quot;, &quot;ProductTypeId&quot;, c =&gt; c.Int(nullable: false, identity: false));
  </code></pre>
  <p>Is there another way to tell SQL to remove the Identity?</p>