AspNetRoleClaim don't have Id as Guid

Ali Sufian 21 Reputation points

I am using identity when i do migration the table AspNetRoleClaim and AspNetUserClaim do not have Id as Guid both tables have int rest of tables such as AspNetUsers and AspNetRoles have Id as Guid

  ApplicationRoleClaim : IdentityRoleClaim<Guid>
    public class ApplicationUserClaim : IdentityUserClaim<Guid>

    public class ApplicationRole : IdentityRole<Guid>
     public class ApplicationUser : IdentityUser<Guid>

        public class AppDbContext : IdentityDbContext<ApplicationUser, ApplicationRole, Guid,ApplicationUserClaim,ApplicationUserRole,ApplicationUserLogin,ApplicationRoleClaim,ApplicationUserToken>
A set of technologies in the .NET Framework for building web applications and XML web services.
2,552 questions
No comments
{count} votes

Accepted answer
  1. Zhi Lv - MSFT 18,786 Reputation points Microsoft Employee

    Hi @Ali Sufian ,

    Please check the definition of the IdentityRoleClaim<Tkey> or the Identity data source. As we can see that, the Tkey is the type of the primary key of the role associated with this claim (the RoleId Property), instead of the Id Property. So, the Id property still is the int type.


    Besides, for the Id property, the Identity defines it as an int, if you try to override this property, it will show the ApplicationRoleClaim.Id': type must be 'int' to match overridden member 'IdentityRoleClaim<Guid>.Id' error. So, I suggest you could try to create a new property to store the Guid value.

    If the answer doesn’t solve your issue, please provide more details of error that will help us track down what’s happening.
    If the answer is helpful, please click "Accept Answer" and vote it up.
    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,

    No comments

0 additional answers

Sort by: Most helpful