我创建了一个表示用户个人资料的类。它还链接到生成的默认asp.net核心applicationUser:
public class ApplicationUser : IdentityUser
{
[ForeignKey("UserProfile")]
public string UserProfileId { get; set; }
[Required]
public virtual UserProfile UserProfile { get; set; }
}
public class UserProfile
{
public string Id { get; set; }
public string Name { get; set; }
public string Status { get; set; }
[Required]
public virtual ApplicationUser User { get; set; }
}
我的问题是,我是否还需要为ApplicationUser创建一个DbSet?
public DbSet<UserProfile> UserProfiles { get; set; }
public DbSet<ApplicationUser> ApplicationUsers { get; set; } //DO I NEED THIS?