我的所有模型至少包含两个关联.在ef4中对此进行建模时,我只能通过使用流畅的界面在没有第二个外键属性的情况下执行此操作.ForeignKey似乎是正确使用的属性,除了它需要一个字符串参数.
所以我的问题是,你能拥有一个导航属性并使用属性声明它吗?
public class User : IAuditable
{
// other code
public virtual User Creator { get; set; }
public virtual User Modifier { get; set; }
}
Run Code Online (Sandbox Code Playgroud) c# mapping entity-framework ef-code-first entity-framework-4.1