This project is read-only.

AddToRole Not working as expected

Mar 13, 2015 at 6:43 PM
Edited Mar 13, 2015 at 6:43 PM

I am trying to add new role to the user but IdentityUser_Id doesn't get populated and it's preventing me to utilize GetRolesAsync method.
var um = new UserManager<User>(new UserStore<User>(new DBContext()));

var idResult = um.AddToRole(userId, roleName);

var roles = await UserManager.GetRolesAsync(roleName);
where roles is always empty.


Any suggestions?
Mar 16, 2015 at 4:22 PM
If anyone finds himself with similar issue, I solved this one by reverting User table name to default one (AspNetUsers). Initially I renamed the table name and somehow confused identity. There's probably code workaround but I am very much satisfied with reverting table name.
Marked as answer by jasenkoh on 3/16/2015 at 8:22 AM