I've extended IdentityUser
to include a navigation property for the user's address, however when getting the user with UserManager.FindByEmailAsync
, the navigation property isn't populated. Does ASP.NET Identity Core have some way to populate navigation properties like Entity Framework's Include()
, or do I have to do it manually?
I've set up the navigation property like this:
public class MyUser : IdentityUser
{
public int? AddressId { get; set; }
[ForeignKey(nameof(AddressId))]
public virtual Address Address { get; set; }
}
public class Address
{
[Key]
public int Id { get; set; }
public string Street { get; set; }
public string Town { get; set; }
public string Country { get; set; }
}
[ForeignKey(nameof(AddressId))]
is not required due to Convention over Configuration. – Sloshy