Hi.
I am testing NHibernate as an option for the architecture of my systems. I created a project with two classes, made my mappings and I can query each one without problems. But I can't figure out how do I do a simple join between these two classes, though I have tried different ways as stated on the docs.
These are my two (simplified) classes:
Code:
'My main class, Persons
Public Class Persons
Private intId As Integer
Private strPerson As String
Public Overridable Property PersonId() As Integer
Get
Return intId
End Get
Set(ByVal value As Integer)
intId = value
End Set
End Property
Public Overridable Property PersonName() As String
Get
Return strPerson
End Get
Set(ByVal value As String)
strPerson = value
End Set
End Property
End Class
'My associated class, Members
Public Class Members
Private intId As Integer
Private intPersonId As Integer
Private strStatus As String
Public Overridable Property MemberId() As Integer
Get
Return intId
End Get
Set(ByVal value As Integer)
intId = value
End Set
End Property
Public Overridable Property PersonId() As Integer
Get
Return intPersonId
End Get
Set(ByVal value As Integer)
intPersonId = value
End Set
End Property
Public Overridable Property MemberStatus() As String
Get
Return strStatus
End Get
Set(ByVal value As String)
strStatus = value
End Set
End Property
End Class
There are a one-to-one relationship between these two classes. On the database side, the members table has a FK to the Persons table on the PersonId column. I need a method that lists the {Persons}.PersonId and the associated {Members}.Status. Do I need to create a third class that contains this method? Where should I put the mapping for this association?
TIA,
rferj