0

I'm looking to add a navigational property to my 'Registration' class, so I can access the parent 'Person'.

Ideally, I would be able to add Public Overrideable Property ParentPerson as Person, but I can't seem to get this to work as it complains about the principle end of association.

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
Jason Evans
  • 28,906
  • 14
  • 90
  • 154
Tom
  • 1,051
  • 4
  • 21
  • 36
  • What is the actual error message that you receive? – Jason Evans Aug 23 '13 at 17:56
  • If I add 'Public Overridable Property Person() As Person' to the Registration class, I get the error "Unable to determine the principal end of an association between the types 'Scout.Registration' and 'Scout.Scout'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations." when trying to deploy changes to the DB – Tom Aug 23 '13 at 18:05
  • This might help : http://stackoverflow.com/questions/16842363/unable-to-determine-the-principal-end-of-an-association-between-the-types Looks like you need a foreign key property to link the types. – Jason Evans Aug 23 '13 at 18:07

0 Answers0