public class ApplicationUser : IdentityUser { public string CustomTag { get; set; } }
Use the ApplicationUser
type as a generic argument for the context:
public class ApplicationDbContext : IdentityDbContext<ApplicationUser> { public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { } protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); } }
Update Pages/Shared/_LoginPartial.cshtml
and replace IdentityUser
with ApplicationUser
:
@using Microsoft.AspNetCore.Identity @using WebApp1.Areas.Identity.Data @inject SignInManager<ApplicationUser> SignInManager @inject UserManager<ApplicationUser> UserManager
Update Areas/Identity/IdentityHostingStartup.cs
or Startup.ConfigureServices
and replace IdentityUser
with ApplicationUser
.
services.AddDefaultIdentity<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true) .AddEntityFrameworkStores<ApplicationDbContext>();