Hi @Ronald Rex ,
By default, the Identity User contains the following properties:
Do you mean you want to modify the property name, for example, modify the Email
to UserEmail
? If that is the case, you could use the Fluent API and HasColumnName()
method to change the property name, code like this:
public class ApplicationDbContext : IdentityDbContext
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<IdentityUser>(
iu => iu.Property(c => c.Email).HasColumnName("UserEmail")
);
}
}
Then, use the following migration commands to enable migration:
add-migration changeIdentityUseremail
update-database
The generate migration file as below:
public partial class changeIdentityUseremail : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Email",
table: "AspNetUsers",
newName: "UserEmail");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "UserEmail",
table: "AspNetUsers",
newName: "Email");
}
}
And the result like this: we can see the Email
column has been changed to UserEmail
Besides, if you mean you want to add custom data to the Identity User table, you could refer the following articles:
Add, download, and delete custom user data to Identity in an ASP.NET Core project
Identity model customization in ASP.NET Core
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion