title: The type cannot be used as type parameter TRole in the generic type or method UserStore
body: <p>I am trying to build an Identity Server using <a href="http://docs.identityserver.io/en/dev/index.html" rel="nofollow">IdentityServer4</a> and ASP.NET Core MVC 1.0.1 in Visual Studio 2015. I already successfully setup the <code>ConfigurationStore</code> and <code>OperationalStore</code> using EntityFramework Core 1.0.1 (<a href="http://docs.identityserver.io/en/dev/quickstarts/8_entity_framework.html" rel="nofollow">section 8</a>). </p>
  
  <p>This is what my <code>project.json</code> file looks like (partial):</p>
  
  <pre><code>{
      "dependencies": {
          "Microsoft.NETCore.App" {
              "version": "1.0.1",
              "type": "platform"
          },
          "Microsoft.AspNetCore.Mvc": "1.0.1",
          /////// Entity Framework /////////
          "Microsoft.EntityFrameworkCore.SqlServer": "1.0.1", 
          "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
          /////// ASP.NET Identity /////////
          "Microsoft.AspNetCore.Identity": "1.0.0",
          "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
          /////// Identity Server //////////
          "IdentityServer4": "1.0.0-rc1-update2",
          "IdentityServer4.AspNetIdentity": "1.0.0-rc1-update2",
          "IdentityServer4.EntityFramework": "1.0.0-rc1-update2",
          ......
      }
  }
  </code></pre>
  
  <p>I am trying to use ASP.NET Identity as my user store in the Identity Server described in <a href="http://docs.identityserver.io/en/dev/quickstarts/6_aspnet_identity.html" rel="nofollow">section 6</a>. By default the ASP.NET Identity uses <code>string</code> as the key for all the tables but I want to use <code>int</code> so I changed them like this:</p>
  
  <pre><code>public class AppUserToken : IdentityUserToken&lt;int&gt; { }
  public class AppUserLogin : IdentityUserLogin&lt;int&gt; { }
  public class AppUserClaim : IdentityUserClaim&lt;int&gt; { }
  public class AppUserRole : IdentityUserRole&lt;int&gt; { }
  public class AppRoleClaim : IdentityRoleClaim&lt;int&gt; { }
  public class AppRole : IdentityRole&lt;int, AppUserRole, AppRoleClaim&gt; { }
  public class AppUser : IdentityUser&lt;int, AppUserClaim, AppUserRole, AppUserLogin&gt;
  </code></pre>
  
  <p>And then I need to create custom user and role store like this:</p>
  
  <pre><code>public class AppRoleStore : RoleStore&lt;AppRole, AppIdentityDbContext, int, AppUserRole, AppRoleClaim&gt;
  {
      public AppRoleStore(AppIdentityDbContext context, IdentityErrorDescriber describer = null)
          : base(context, describer)
      {}
  
      .......
  }
  
  public class AppUserStore : UserStore&lt;AppUser, AppRole, AppIdentityDbContext, int, AppUserClaim, AppUserRole, AppUserLogin, AppUserToken&gt;
  {
      public AppUserStore(AppIdentityDbContext context, IdentityErrorDescriber describer = null) 
          : base(context, describer)
      { }
  
      ............
  }
  </code></pre>
  
  <p>Last but not least, my <code>AppIdentityDbContext</code>:</p>
  
  <pre><code>public class AppIdentityDbContext : IdentityDbContext&lt;AppUser, AppRole, int, AppUserClaim, AppUserRole, AppUserLogin, AppRoleClaim, AppUserToken&gt;
  {
      public AppIdentityDbContext(DbContextOptions&lt;AppIdentityDbContext&gt; options)
          : base(options)
      { }
  
      public override void OnModelCreating(ModelBuilder builder)
      {
          builder.Entity&lt;AppUser&gt;().ToTable("Users");
          builder.Entity&lt;AppUserLogin&gt;().ToTable("UserLogins");
          builder.Entity&lt;AppUserClaim&gt;().ToTable("UserClaims");
          builder.Entity&lt;AppUserToken&gt;().ToTable("UserTokens");
  
          builder.Entity&lt;AppRole&gt;().ToTable("Roles");
          builder.Entity&lt;AppRoleClaim&gt;().ToTable("RoleClaims");
  
          builder.Entity&lt;AppUserRole&gt;().ToTable("UserRoles");
      }
  }
  </code></pre>
  
  <p>But I am getting a build error on <code>AppUserStore</code>:
  <em>The type AppRole cannot be used as type parameter 'TRole' in the generic type or method 'UserStore'. There is no implicit reference conversion from 'AppRole' to 'Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole>'.</em></p>
  
  <p>wtf?</p>