打开IdentityModels.cs
位于ProjectName > Models > IdentityModels.cs
。导航至ApplicationUser
课程。
从那里您可以添加自定义属性。由于您使用的是代码优先方式,因此只要您update-database
确定要提供数据注释,Entity Framework就会自动为您映射属性
ForeignKey("PropertyName")
public class ApplicationUser : IdentityUser
{
public string GivenName { get; set; }
public string MiddleName { get; set; }
public string LastName { get; set; }
public int? EmployeeId{ get; set; }
[ForeignKey("EmployeeId")]
public Employee Employee{ get; set; }
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句