AddEntityFrameworkStores can only be called with a role that derives from IdentityRole in .NET Core 2.0

Long time since I asked this question, but here's how I deal with nowadays:

Startup.cs

services.AddIdentity<User, Role>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
services.AddScoped<RoleManager<Role>>();

Entites:

public class User : IdentityUser<int>
{
}

public class Role : IdentityRole<int>
{
}

For same issue, you can look at this:https://github.com/aspnet/Identity/issues/1364