I'm using a legacy database schema which cannot be changed (although it can be added to, keys, columns etc).
I have two tables that have no direct relationships between them. There is then a third table, a link table, which simply references the two tables with foreign keys. A record in this third table is meant to be unique (although it isn't enforced with a key yet!) and it indicates that a row in Table1 is related to only 1 row in Table2 and vice-versa. Questions: What classes should I have? It seems like I ought to have just two classes that each have a single reference to each other. How do I go about mapping this? I can't use HasOne because that requires that the keys in each table are unique, and besides I have the link table in the way. I could create 3 classes, one for each table, but I can't seem to avoid implementing one-to-many relationships (which I couldn't get to work either). I intend to add a composite key to the link table to enforce the unique relationship, in case that assists with the mapping? Simplified schema, if it helps: Table1 (Table1_Id (pk), Name) Table2 (Table2_Id (pk), Name) Table3 (Table1_Id (fk), Table2_Id (fk)) Thanks in advance Boz -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en.
