我希望在我的“注册”课程中添加一个导航属性,这样我就可以访问父“人”了。
理想情况下,我可以添加Public Overrideable Property ParentPerson as Person
,但我似乎无法让它工作,因为它抱怨关联的主要结束。
Public Class Person
<Required()>
Public Property ID As Integer
<Required()>
<StringLength(150)>
Public Property Firstname As String
<Required()>
<StringLength(150)>
Public Property Lastname As String
Public Overridable Property Registration As Registration
End Class
Public Class Registration
<Required()>
Public Property ID As Integer
Public Property RegistrationDate As Date
Public Overridable Property Sessions As List(Of RegistrationSession)
End Class