I was created a IdentityUser table and IdentityRoleTable succefully and I can Insert it in both too. even I was created a IdentityUserRole Tables Succefully too but when I want to assign user to the roles that is previously defined it was occure:
Cannot create a DbSet for 'IdentityUserRole' because this type is not included in the model for the context
IdentityUserRole Code :
public class AppUserRole<T>:IdentityUserRole<string>
{
public virtual AppUser AppUser { get; set; }
public virtual AppRole AppRole { get; set; }
}
DataContext Class:
public DbSet<AppUserRole<string>> AppUserRole { get; set; }
protected override void OnModelCreating(ModelBuilder builder) {
builder.Entity<AppUserRole<string>>().HasKey(p => new { p.UserId, p.RoleId });
}