views:

120

answers:

1

Hi,

Let's say I have a simple parent->child class structure as shown below

Public Class Parent
  Public ParentID As Integer
  Public Children As IList(Of Child)
End Class

Public Class Child
  Public ChildID As Integer
  Public Parent As Parent
End Class

These are mapped to two tables using Fluent NHibernate. No problem.

I now have a 3rd class, let's call 'User'. This class contains a list of Parent objects.

Public Class User
  Public UserID As Integer
  Public Parents As IList(Of Parent)
End Class

However, the list of parents should be filtered to the user by a mapping table (UserParentMap) which contains UserID and ParentID. Furthermore, the 'Child' objects should be filtered in a similar way by a table called UserChildMap which contains UserID and ChildID.

My question is - is it possible to get NHibernate to automatically use these mapping tables to filter the parent/child collection when mapping them to the user?

Thanks

James

A: 

I don't think what I want to do is possible so I'm abandoning this question :)

James