How to add a foreign key reference to ASP.Net MVC 5 Identity?

后端 未结 3 1876
無奈伤痛
無奈伤痛 2021-01-30 04:16

I have a new ASP.NET MVC 5.1 project using the ASP.Net Identity. It seems reliable and promise, but today i spend almost 9 hours to do a simple things if using SQL.

My p

3条回答
  •  爱一瞬间的悲伤
    2021-01-30 04:48

    You can do like this. because sometime you may need 1-1 connection

     public class AnotherTable
        {
            [Key]
            public string UserId { get; set; }
    
            [ForeignKey("UserId")]
            public virtual ApplicationUser User { get; set; }
        }
    

提交回复
热议问题