I have an AppUser class that inherits from IdentityUser and contains an Inventory object:
public class AppUser : IdentityUser
{
public InventoryModel? Inventory { get; set; }
}
I've been using this line to get the current user with all their properties:
var user = await _userManager.GetUserAsync(User);
Any primitive data types I put in AppUser can be accessed this way, but it seems to be lazy loading and not bringing the inventory along with it. I have manually queried my database and I see that the user I'm getting has an Inventory.InventoryId of 14 (primary key identifier for the Inventory class), but when I use the above statement to get the user, their Inventory is always null.
Is there some kind of ".Include()" that can be used with GetUserAsync? Is there another way I should be doing this?