title: Entity Type Has No Key Defined
body: <p>Another 'Entity Type 'x' has no key defined' question, but I've set the <code>[Key]</code> attribute on a property so I'm a bit confused.</p>
  
  <p>Here's my entity and context classes:</p>
  
  <pre><code>namespace DoctorDB.Models
  {
      public class Doctor
      {
          [Key]
          public string GMCNumber;
          [Required]
          public string givenName;
          [Required]
          public string familyName;
          public string MDUNumber;
          public DateTime MDUExpiry;
          public string MDUCover;
      }
  
      public class DoctorContext : DbContext
      {
          public DbSet&lt;Doctor&gt; Doctors { get; set; }
      }
  }
  </code></pre>
  
  <p>When I go to create my controller, I've selected to create it with the Entity Framework methods using this entity and context:</p>
  
  <p><img src="https://i.stack.imgur.com/K1IS1.png" alt="enter image description here"></p>
  
  <p>and I get this error:</p>
  
  <p><img src="https://i.stack.imgur.com/hGHhj.png" alt="enter image description here"></p>
  
  <p>My only thought is whether you can't successfully use [Key] on a string property. If you can't then fair enough, I'll work round it, but I'd be grateful if someone could confirm this one way or the other.</p>