There is currently an ApplicationUser class with some custom properties, for example:
public class ApplicationUser : IdentityUser { public string Name { get; set; } public List<Content> Content { get; set; } }
I want the current registered user with a list of related data ( Content property).
In my controller, if I put:
Applicationuser user = await _userManager.GetUserAsync(HttpContext.User);
I get a registered user, but without any related data. But if I extract the current user using ApplicationDbContext , as shown below, I can get the related data:
ApplicationUser user = await _userManager.GetUserAsync(HttpContext.User); ApplicationUser userWithContent = _context.Users.Include(c => c.Content).Where(u => u.Id == user.Id).ToList();
But that doesn't look right to me!
Any idea?
source share