之间的关联的主要结束我使用Entity Framework
这里是我的实体模型:无法确定类型的“X”和“X”
Public class Document
{
Public int Id { get; set; }
Public Document Parent { get; set; }
}
,当你看到它有一个self-reference
属性。
现在我想要添加另一个self-reference
属性是这样的:
Public class Document
{
Public int Id { get; set; }
Public Document Parent { get; set; }
Public Document SrcDocument { get; set; }
}
但不幸的是,我遇到以下错误:
Unable to determine the principal end of an association between the types 'Document' and 'Document'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations.
难道你想与一个一对多的关系? –
有些是如何,但它不起作用? – Reza
是否会编写任何代码来定义这些关系? –