Since I prefer Guidmy primary key type, my classes Userand Roleimplemented as follows:
public class User : IdentityUser<Guid, UserClaim, UserRole, UserLogin>
{
}
public class Role : IdentityRole<Guid, UserRole, RoleClaim>
{
}
Note that UserClaim, UserRole, UserLoginand RoleClaimare implemented in the same way
Here is my implementation DbContext
public class ApplicationDbContext : IdentityDbContext<User, Role, Guid, UserClaim, UserRole, UserLogin, RoleClaim, UserToken>
{
}
Everything until now, except for the AspNetCore new DI container, apparently doesn't like my default user implementation. The following line of code from my Startup.cs file causes the error shown below
services
.AddIdentity<User, Role>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
GenericArguments [0], 'NewCo.DomainModel.Models.Identity.User', on 'Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore`4 [TUser, TRole, TContext, TKey] violates the restriction of type "TUser".
, , Identity gremlin IdentityUser<string>, IdentityUser<Guid>.
? ( outta)
. Microsoft Core Core ASP.NET Core (27 2016 ) Visual Studio Update 3 ( )