title: EF Core: The entity type 'User' requires a primary key to be defined
body: <p>I am trying to get EF Core up and running, but it consistently complains about my table requiring a primary key. Now the existing questions surrounding this issue haven't solved it for me.</p>
  <p>The model:</p>
  <pre><code>public class User
  {
      [Column(&quot;id&quot;)]
      public long Id { get; }
  }
  </code></pre>
  <p>I have tried adding the <code>[Key]</code> attribute:</p>
  <pre><code>public class User
  {
      [Key]
      [Column(&quot;id&quot;)]
      public long Id { get; }
  }
  </code></pre>
  <p>I have even tried adding the <code>[Key]</code> attribute with an option:</p>
  <pre><code>[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  </code></pre>
  <p>After all of the attempts, I still get this error:</p>
  <blockquote>
  <p>Unhandled exception. System.InvalidOperationException: The entity type 'User' requires a primary key to be defined. If you intended to use a keyless entity type call 'HasNoKey()'.</p>
  </blockquote>