I\'m following the documentation for using Identity and am trying register a new user (executing the register action), but it fails with the following error:
Create new context class which inherit IdentityDbContext.
public class ApplicationDbContext : IdentityDbContext
{
public ApplicationDbContext(DbContextOptions options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
// Customize the ASP.NET Identity model and override the defaults if needed.
// For example, you can rename the ASP.NET Identity table names and more.
// Add your customizations after calling base.OnModelCreating(builder);
}
}
and in startup.cs file add below code
services.AddDbContext(options =>
options.UseSqlServer(connection));
This will help you for database first approach.