Search code examples
nhibernatefluentmappings

Fluent NHibernate one-one mapping through additional table


I have a table A that has a references to a table B through a third table C. C contains the primary key of A and B. For each A there is at most one record in C. When I try to create a mapping for A such that I am referencing B, I use the References function, but it does not allow me to specify that the mapping goes through another table and not directly. What is the proper way to do that?


Solution

  • I believe I have found the answer in google code samples. In the mapping class, it is possible to write an additional:

    WithTable("SomeTable", c => { c.Map(x => x.Col1); });