When you add Identity: "services.Addidentity", you can pass your custom classes, for example, to the user:
services.AddIdentity<UsuarioCustomizado>();
Custom User must inherit the Identityuser class, so you add custom fields, in which case I added the CPF:
public class ApplicationUser: IdentityUser
{
public string CPF { get; set; }
}
Now for you to customize in the database as the keys, using EF Core, you can create a context by inheriting Identitydbcontext:
public class ApplicationDbContext: IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.ApplyConfiguration(new ApplicationUserEntityTypeConfiguration());
// 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 finally in Onmodelcreating you can change the settings of the tables.
Reference: https://docs.microsoft.com/pt-br/aspnet/core/security/authentication/customize-identity-model?view=aspnetcore-2.2