I need to make a custom collection (an ISet<>) that in user code, I use a non-empty constructor. Specifically, the constructor takes information about the class containing the collection and the custom collection uses that reference for business logic on Add/Remove overrides. I know NHibernate instantiates using the default constructor, but is there anyway I can get a handle to the owning Entity from either the session or persister?
If not, is there a way to force NHibernate to use 'Wrap' the field instance instead of swapping it out? In the Entity constructor, I have this:
Code:
public Entity()
{
members = new MemberSet(this)
}
but if NHibernate loads off of the DB, it tosses my set rather than wrapping it.