title: Identity Specification false Entity Code First
body: <p>I have the fallowing 2 classes:</p>
  
  <pre><code>[Table("People")]
      public class Person : IPerson
      {
          [Key]
          [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
          public int Id { get; set; }
          public string FirstName { get; set; }
  
          public Person()
          {
              Results = new Collection&lt;Result&gt;();
          }
          public string LastName { get; set; }
  
          public string Name
          {
              get
              {
                  return FirstName + " " + LastName;
              }
              set{}
          }
  
          public string Email { get; set; }
          public DateTime? LastModified { get; set; }
          public virtual ICollection&lt;Result&gt; Results { get; set; }
      }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>[Table("UserProfile")]
  
      public class UserProfile : Person
      {
          public UserProfile()
          {
              Faculty = new Faculty();
              Projects = new Collection&lt;Project&gt;();
          }
          public string UserName { get; set; }
          public string CNP { get; set; }
          public virtual Faculty Faculty { get; set; }
          public virtual ICollection&lt;Project&gt; Projects { get; set; }
      }
  </code></pre>
  
  <p>Every time i use EF CodeFirst to generate my DB, and try too run the seed method i get an error. <strong>An error occurred while updating the entries. See the inner exception for details. System.Data.SqlClient.SqlException: Cannot insert explicit value for identity column in table 'UserProfile' when IDENTITY_INSERT is set to OFF.</strong> You can find more about it here <a href="https://stackoverflow.com/questions/19934366/seeding-membership-with-custom-data-entity-framework">Seeding Membership with custom data Entity framework</a></p>
  
  <p>I found out that to fix it after running <code>update-database</code> from the package manager console i have to open the table in server explorer and set <code>Idendtity Specification</code> to false for the <strong>Id</strong> in the <strong>UsersProfile</strong> table, my question is can i do something to my model so that i won't have to this every time i regenerate my Db.</p>
  
  <p>I tried the answer from here <a href="https://stackoverflow.com/questions/14829911/identity-specification-set-to-false">Identity specification set to false</a> but because of the inheritance (i think) i get</p>
  
  <pre><code>Conflicting configuration settings were specified for property 'Id' on type 'Prometheus.Models.Person': 
      DatabaseGeneratedOption = None conflicts with DatabaseGeneratedOption = Identity
  </code></pre>
  
  <p>Thank you.</p>