【发布时间】:2013-11-20 19:29:35
【问题描述】:
我有一个Holiday 表和一个User 表。
Holiday 表有 RequesterID 和 AuthorisedByID 列,它们都链接到 User 表的主键。
这是我的Holiday 模特:
public class Holiday
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid HolidayId { get; set; }
[ForeignKey("UserId")]
public virtual User User { get; set; }
public Guid RequesterId { get; set; }
public Guid? AuthorisedById { get; set; }
}
我无法在 User 表中将 AuthorisedByID 声明为外键,就像我对 RequesterId 列所做的那样。
我想知道你能否给我一些关于如何解决的提示。
谢谢。
【问题讨论】:
标签: entity-framework ef-code-first entity-framework-migrations