We have the following:
- Owner and Thing are domain classes.
- Owner has a Property, Things, as follows: IDictionary<string, IList<Thing>>
We want to be able to map this dictionary w/ nHibernate. Without using nHibernate, we'd just create 3 tables and the queries are straightforward:
tblOwner: ID (int), other fields
tblThing: ID (int), other fields
tblOwnerThing: ID, FK_OwnerID, FK_ThingID, dictKey (string)
e.g. sample records in tblOwnerThing:
1) dictKey="owner1", FK_ThingID=ID for 'Thing1', FK_OwnerID=ID for 'OwnerA'
2) dictKey="owner1", FK_ThingID=ID for 'Thing2', FK_OwnerID=ID for 'OwnerA'
3) dictKey="owner2", FK_ThingID=ID for 'Thing3', FK_OwnerID=ID for 'OwnerB'
4) dictKey="owner2", FK_ThingID=ID for 'Thing4'
, FK_OwnerID=ID for 'OwnerB'
How can we do this in nHibernate?
Thanks,
Bill
_________________ metazone
|