Try to change like below:
services.AddDefaultIdentity<User>()
.AddEntityFrameworkStores<ApplicationDbContext>();
Be sure your DbContext like below:
public class ApplicationDbContext : IdentityDbContext<User>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
}
}
Be sure update _LoginPartial.cshtml
and replace IdentityUser
with User
:
@inject SignInManager<User> SignInManager
@inject UserManager<User> UserManager
Finally,you could scarffold the Identity.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…