In order to support the ASP.NET Core Identity service, our ApplicationDbContext class needs to be updated as well.
Open the Data/ApplicationDbContext.cs class file and perform the following changes:
- Add a using reference to Microsoft.AspNetCore.Identity.EntityFrameworkCore, as required by the new base class:
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
- Change the base class from DbContext to IdentityDbContext<ApplicationUser>:
[...]
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
[...]
- Remove the DbSet<ApplicationUser> Users property, as the IdentityDbContext base class that we just inherited already has it built in:
[...]
#region Properties
// public DbSet<ApplicationUser> Users { get; set; }
public DbSet<Quiz> Quizzes { get; set; }
[...]