public class ApplicationUser : IdentityUser
{
public string FullName { get; set; }
public CompanyProfile CompanyProfile { get; set; }
public CustomerProfile CustomerProfile { get; set; }
}
以及特定于角色的配置文件类似于这样:
public class CompanyProfile
{
public int Id { get; set; }
public string UserId { get; set; }
public ApplicationUser User { get; set; }
public string CompanyName { get; set; }
public string Description { get; set; }
}
public class CustomerProfile
{
public int Id { get; set; }
public string UserId { get; set; }
public ApplicationUser User { get; set; }
}
这种方法(使用特定于角色的数据使用单独的配置文件类)被认为是ASP.NET身份中的清洁结构?
在保持身份模型清洁的同时,有任何最佳实践或替代模式来处理多种用户类型(例如公司和客户)?可能的解决方案是要有一个类别的类别,其中您拥有所有资料所需的一切,包括
BaseProfile