How to Change Asp.net Core Identity AspNetUsers Role Primary key Data Type

Viewed 20

I am trying to change the Data Type of .NET core Identity AspNetUsers primary key data type from GUID to Int. but couldn't find a way. What can I do to change only AspNetUsers primary key data type.

1 Answers

on model creating event

modelBuilder.Entity<ApplicationUser>(b =>
{

   // Primary key
    b.HasKey(u => u.Id).HasColumnType("int");
    
    //other configuration
            
});

then run in package manager console

Run Update-Database
Related