扩展身份用户以创建配置文件

时间:2018-05-07 20:20:31

标签: c# asp.net-core entity-framework-core one-to-one ef-core-2.0

我创建了一个表示用户个人资料的类。它还链接到生成的默认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?

0 个答案:

没有答案