NHibernate 1.2
.Net 3.5
SQL Server 2005
I apologize for the title, I couldn't think of anything better.
If I need to tweak the schemas to accomplish my goals, that's fine.
Here are my questions.
1. How do I create many-to-many associations with just an ID?
For example:
assume the following schema
Code:
Entity1
id
Entity2
id
Entity1_Entity2
entity1_id
entity2_id
NOTE: mapping does not need to be bi-directional, Entity1 is the parent
NOTE2: I'm currenting using an ISet/HashedSet<> in the C# entity, but I'm completely flexible on this.
NOTE3: the association table has a composite PK to enforce unique elements in the set
if I want to insert an Entity1 record but I only have the id value of the entity2's, how would I go about doing this?
2. How do I create an ordered many-to-many association?
For example:
assume the following schema
Code:
Entity3
id
Entity4
id
Entity3_Entity4
entity3_id
entity4_id
sequence
NOTE: mapping does not need to be bi-directional, Entity3 is the parent
NOTE2: I'm mostly confused about the configuration
NOTE3: the association table has a composite PK to enforce unique elements in the set
I want to be able to order the children (Entity4).
Hopefully that's not confusing :(
I've looked through the NHibernate documentation and didn't come across anything dealing with either of these. If I just missed it, I'd love a link to the relevant section :)
Thanks for the help.