【发布时间】:2020-09-26 09:52:34
【问题描述】:
我有继承自身份用户的应用程序用户
public class ApplicationUser : IdentityUser
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string IDNumber { get; set; }
public string PhysicalAddress { get; set; }
}
和另一个继承自 ApplicationUser 的 VendorUser
public class VendorUser : ApplicationUser
{
public int? VendorUserId { get; set; }
public int CardNumber { get; set; }
public string PhotoIDUrl { get; set; }
}
如果我在 startup.cs 文件中注册服务,例如:
services.AddIdentity<ApplicationUser, IdentityRole>().AddEntityFrameworkStores<AppDbContext>();
services.AddIdentity<VendorUser, IdentityRole>().AddEntityFrameworkStores<AppDbContext>();
我得到了上面的错误。
如果我不解决它无法解决 VendorUser 的服务。如何解决 VendorUser 的服务而不出现该错误
【问题讨论】:
-
能否分享一下详细的AppDbContext?您是否为 ApplicationUser 创建两个表,另一个为 VendorUser ?
标签: c# asp.net asp.net-mvc asp.net-core