efcore icon indicating copy to clipboard operation
efcore copied to clipboard

Want PrimaryKey be TKey rather than Int in IdentityUserClaim class.

Open ogswr opened this issue 6 years ago • 4 comments

I want to handle more than 32bit records in AspNetUserClaims table.

Hiding doesn't work acording to #12565 public class CustomIdentityUserClaim : IdentityUserClaim<string> { public new string Id { get; set; } }

so, I want you to change base class (IdentityUserClaim) property type public virtual int Id { get; set; } => public virtual Tkey Id { get; set; }

ogswr avatar Dec 09 '19 00:12 ogswr

@ogswr This is documented. If you need more than what is covered by that documentation, then please file an issue on the ASP.NET repo which is where Identity is maintained.

ajcvickers avatar Dec 09 '19 00:12 ajcvickers

got it. thanks.

ogswr avatar Dec 09 '19 00:12 ogswr

@ajcvickers Even after reading all the issues and linked documentation I am still unable to change Id type of IdentityUserClaim can you point me in right direction?

By looking at the IdentityUserClaim implementation I see the you can provide type for UserId but not for Id.

  public class IdentityUserClaim<TKey> where TKey : IEquatable<TKey>
  {
    ...
    public virtual int Id { get; set; }
    public virtual TKey UserId { get; set; }
    ...
  }

but in IdentityUser you can provide type for Id

  public class IdentityUser<TKey> where TKey : IEquatable<TKey>
  {
    ...
    public virtual TKey Id { get; set; }
    ...
  }

I expect you to advise me to open new issue but please consider that most people googling this problem will end up here after clicking through multiple issues as I did.

kolpav avatar Apr 03 '21 16:04 kolpav

@kolpav The identity model does not allow this key type to be changed. You could request this be changed by filing an issue at ASP.NET Core, but it's been like this for a long time and I don't think there are plans to change it.

ajcvickers avatar Apr 06 '21 17:04 ajcvickers