title: EF Core how add Primary Key
body: <p>I have this class definition into Ef Core Model for SQLite.</p>
  
  <pre><code>public class Ejercicios : BaseModel
  {
      private int _TipoEjercicio;
      [Key]
      public int TipoEjercicio
      {
          get { return _TipoEjercicio; }
          set { SetProperty(ref _TipoEjercicio, value); }
      }
  
      private string _DescripcionEjercicio;
      public string DescripcionEjercicio
      {
          get { return _DescripcionEjercicio; }
          set { SetProperty(ref _DescripcionEjercicio, value); }
      }
  
      private string _HexForeColor;
      public string HexForeColor
      {
          get { return _HexForeColor; }
          set { SetProperty(ref _HexForeColor, value); }
      }
  
      private string _HexBackGroundColor;
      public string HexBackGroundColor
      {
          get { return _HexBackGroundColor; }
          set { SetProperty(ref _HexBackGroundColor, value); }
      }
  }
  </code></pre>
  
  <p>Now my problem is when I try to run <strong>Add-Migration</strong>, throws </p>
  
  <pre><code>System.InvalidOperationException: The entity type 'Ejercicios' requires a primary key to be defined.
  </code></pre>
  
  <p>How to add primary key to an EF Core Model for sqlite ? </p>
  
  <p><strong>Edit 1:</strong> Model Generator</p>
  
  <pre><code>public class MyContext : DbContext
  {
      public DbSet&lt;Ejercicios&gt; Ejercicios { get; set; }
  
  
      protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
      {
          optionsBuilder.UseSqlite("Filename=MyDb.db");
      }
  }
  </code></pre>