I have a method that gets all the users that I have in my db, just put this:
var allUsers = context.Users.ToList();
What I cannot understand is that when I debug the role property, it is empty:

but in dbo.UserRoles:

What am I missing here?
EDIT:
My registration method:
public async Task<ActionResult> Register(RegisterViewModel model)
{
if (ModelState.IsValid)
{
var user = new ApplicationUser { UserName = model.Email, Email = model.Email, FirstName = model.FirstName, LastName = model.LastName };
var result = await UserManager.CreateAsync(user, model.Password);
if (result.Succeeded)
{
UserManager.AddToRole(user.Id, model.UserRole.ToString());
return RedirectToAction("Index", "Home");
}
AddErrors(result);
}
return PartialView("~/Views/Account/Register.cshtml",model);
}
EDIT 2:
When creating such roles:
var roles = context.Roles.ToList();
I can see all the roles, and I can also see which users have a specific role:

EDIT 3:
Tried turning off and off lazyloading
this.Configuration.LazyLoadingEnabled = true;
this.Configuration.LazyLoadingEnabled = false;
Still not giving me role data.
source
share