This topic deals with the join tables functionality available in Entity Developer for NHibernate, that allows mapping properties of one class to several tables, when there's a 1-to-1 relationship between the tables.
For the purposes of the example below, we create a database containing the Orders and OrderDetails tables linked through a one-to-one association:
We perform the following sequence of operations:
Before joining the table properties into one class, the model looks as follows:
We select the Product, Price and Quantity properties of the OrderDetail entity and drag them into the Order entity. Then we select the Order entity and in the Properties window, locate and click the Join Tables row, and then click the displayed three-dotted button. The Join Tables Editor dialog box is displayed. Click the Add button to add the Join Table.
Note, that the Schema property value is set to 'dbo' and the Table property value is changed from the default value to 'OrderDetails'. Besides, under Column in the Key Columns area, we set the primary key name of the OrderDetails table (OrderID). To complete the procedure of properties mapping, we select the Product, Price and Quantity properties of the Order entity and in the Join Table combo-box of the Properties window, we select the dbo.OrderDetails value. After this we delete the OrderDetail entity from the model. As a result we have the model with a single Order class and for a part of its properties the Join Table values are defined: |