How to map AspNetUser table id as foreign key to another table

asp.net-mvc c# entity-framework-6

Question

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?

1
0
4/2/2017 3:35:15 AM

Popular Answer

Perhaps, the ForeignKey attribute this will help you:

public string UserId {get; set;}

[ForeignKey("UserId")]     
public AspNetUser User {get; set;}
1
4/2/2017 6:43:31 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow