我在Identity 3
ASP.NET 5 RC1/Core
我需要在ApplicationUser中创建一个外键引用,该引用使用EF Code First
引用ApplicationUser(IdentityUser)的主键。
我试过了
public class ApplicationUser : IdentityUser
{
[Column("fk_LineManagerUserId")]
public Guid LineManagerUserId { get; set; }
[ForeignKey("LineManagerUserId")]
public virtual ApplicationUser LineManagerUser { get; set; }
}
或
public class ApplicationUser : IdentityUser
{
[Column("fk_LineManagerUserId")]
public string LineManagerUserId { get; set; }
[ForeignKey("LineManagerUserId")]
public virtual ApplicationUser LineManagerUser { get; set; }
}
但我得到
介绍FOREIGN KEY约束' FK_ApplicationUser_ApplicationUser_LineManagerUserId'在桌上' AspNetUs ERS'可能会导致循环或多个级联路径。指定ON DELETE NO ACTION或ON UPDATE NO ACTION,或修改其他FOREIGN KEY约束。