title: The entity type 'Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>' requires a key to be defined
body: <p>All was working fine until I introduced Identity.</p>
  
  <p>I changed my context class to be:</p>
  
  <pre><code>public partial class VisualJobsDbContext : IdentityDbContext&lt;ApplicationUser&gt;
  {
      private IConfigurationRoot _config;
  
      public VisualJobsDbContext() { }
  
      public VisualJobsDbContext(IConfigurationRoot config, DbContextOptions options) : base(options)
      {
          _config = config;
      }...
  </code></pre>
  
  <p>and I have a Generic repository that is declared in the form:</p>
  
  <pre><code>public abstract class GenericRepository&lt;C,T&gt; : IGenericRepository&lt;T&gt; where T : class where C : IdentityDbContext&lt;ApplicationUser&gt;, new() 
  {
      private C _entities = new C();
      private VisualJobsDbContext context;
      private DbSet&lt;T&gt; dbSet;
  
      public GenericRepository(VisualJobsDbContext context)
      {
          this.context = context;
          this.dbSet = context.Set&lt;T&gt;();
      }....
  </code></pre>
  
  <p>The Error occurs on the </p>
  
  <blockquote>
    <p>this.dbSet = context.Set&lt;>();</p>
  </blockquote>
  
  <p>the first time it gets hit. My OnModelCreating method does get called. The page I'm trying to get to from my MVC app does not require a login as it is a general page, but there will be areas that will require a login. However, I dont get as far as my controller Constructor method before it errors. To Register the service I have:</p>
  
  <pre><code>services.AddIdentity&lt;ApplicationUser, IdentityRole&gt;()
              .AddEntityFrameworkStores&lt;VisualJobsDbContext&gt;()
              .AddDefaultTokenProviders();
  </code></pre>
  
  <p>and I can step this ok.</p>
  
  <p>any ideas what I'm missing? I have looked at this <a href="https://stackoverflow.com/questions/28531201/entitytype-identityuserlogin-has-no-key-defined-define-the-key-for-this-entit">stackoverflow answer</a> and others, but it doesn't really help</p>