Allow separate TKey
for the various Identity Entities, like IdentityUser<TUserKey>
and IdentityRole<TRoleKey>
#51868
Unanswered
KennethHoff
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I was just setting up a new simple Web App by creating simple AspNetCore Identity setup, and I did so by doing what I normally do when I create new domain models; Creating custom Typed identifiers for each domain model, but I quickly realized that, for whatever reason,
IdentityUser<TKey>
, andIdentityRole<TKey>
requiresTKey
to be the sameTKey
. This is very annoying and breaks the type-safety of my app.So I'm wondering; Would it be possible to rework this signature to allow for separate TKey for each entity type?
aspnetcore/src/Identity/EntityFrameworkCore/src/IdentityDbContext.cs
Line 77 in 7f18f8f
For example this:
Most people is probably fine with a simple
TKey
, but an additional overload that allows for improved type-safety would be very much appreciated.Assuming dotnet/csharplang#5497 gets implemented before this, you could add a constraint that requires them all to be (explicit) extensions of some base identifier(Say for example, they all have to be
Tkey
orexplicit Extension X for TKey
) if that is some fundamental constraint in the Identity system as a whole.Beta Was this translation helpful? Give feedback.
All reactions