[英]How to map AspNetUser table id as foreign key to another table
public class UserInfo
{
public int id {get;set;} //Primary key
public string UserId {get; set;} // Foreign key to AspNetUser - Id
public string FirstName {get;set;}
public string LastName {get;set;}
......
......
}
How can I extend the AspNetUser table in the above fashion in EF6 code first approach? 如何以EF6代码优先方式以上述方式扩展AspNetUser表?
Perhaps, the ForeignKey
attribute this will help you: 也许, ForeignKey
属性可以帮助您:
public string UserId {get; set;}
[ForeignKey("UserId")]
public AspNetUser User {get; set;}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.