I've got a data model that I'm not sure fluent nHibernate supports - was wondering if anyone could tell me whether it does, and if so, how to do it. The basic structure is:
create table Container (
id int identity(1,1) NOT NULL,
root_item_id int
)
create table ItemRelationship (
id int identity(1, 1) NOT NULL,
parent_item_id INT,
child_item_id INT
)
create table Item (
id int identity(1, 1) NOT NULL,
description VARCHAR(20)
)
So in a nutshell: 1) Container has a Root Item 2) Items can have children Items
What I want is a property on my "Container" entity that is a Collection of the Items that are the CHILDREN of it's Root Item. I can see how to setup "direct" FK relationships, but this one is a little unusual, as the chain of relationship is:
Container.root_item_id -> ItemRelationship.parent_item_id
There's not an explicit FK there. I'm assuming I have to use the "Where" method in some fashion, but am not sure how - wasn't able to find examples. Any ideas?