title: Writing AutoIncrement for primary key in CodeFirst
body: <p>I am using CodeFirst in my project. One of the things I am learning is how I can design my tables by first writing classes. My question is - how can I classify the primary key [key] Id, as an auto increment field. So that when a record is created (or a row in the table) the primary key is auto generated. How do I do this in codefirst while writing class definition. Thanks for the help.</p>
  
  <pre><code> public class NewTable
  {   
     //Looking for something like [AutoIncrement][key] for Id field etc...
      [key]
      public int Id { get; set; }
  
      [Required(ErrorMessage = "Title is required")]
      [DisplayName("Title")]
      public string Title { get; set; }
  
  }
  </code></pre>