aspnet / Identity

[Archived] ASP.NET Core Identity is the membership system for building ASP.NET Core web applications, including membership, login, and user data. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
1.96k stars 868 forks source link

IdentityServiceCollectionExtensions.AddIdentity<TUser,TRole>() doesn't have a type constraint for IdentityUser and IdentityRole #1836

Closed Kiiyya closed 6 years ago

Kiiyya commented 6 years ago

Basically this becomes a run-time exception while it could easily be a compile time error:

image

(Hint: I'm still new to Asp.Net authentication so I might be wrong)

HaoK commented 6 years ago

This is intentional, AddIdentity allows arbitrary TUser/TRole types, its AddEntityFrameworkStores that requires TUser/TRole to be derived from IdentityUser/Role