The Many to Many Relationship Editor allows you to add and edit a many to many, or indirect, relationship. A many to many relationship is a relationship build on top of two many-to-one (m:1) relationships. To open the Many to Many Relationship Editor to add a new relationship, you can use Project -> New -> Many to Many Relationship from the main menu, by clicking the New Many to Many Relationship Editor button on the toolbar, by pressing cntrl-shift-M, or by right-clicking on an entity's 'Relationships' node in Project Explorer. You can edit a many to many relationship by right-clicking it in the Project Explorer or in the ModelView Editor.
The Many to Many Relationship Editor consists of two parts which are described below
This area lets you specify which entities are indirectly related to each other through a many to many relationship by specifying the two many to one relationships the many to many relationship has to be based upon. You start by selecting the start entity from the combo box. This will be one side of the many to many relationship.
After that, select the relationship from the second combo box which relates the start entity with the intermediate entity. The intermediate entity is the entity in the middle of the many to many relationship and which is the foreign key side of both many to one relationships a many to many relationship is based upon.
After the first relationship has been chosen, the second relationship can be chosen using the third combo box. This combo box enlists all m:1 relationships where the intermediate entity (the related entity to the start entity over the first relationship chosen) is on the foreign key side. By selecting a relationship the end entity of the relationship is determined which is displayed after 'with' in the read-only textbox.
This area allows you to specify the navigators for both sides of the relationship. These navigators are seen as 'mapped' onto the relationship to create. LLBLGen Pro will try to formulate the initial values of the navigators from the entities specified and the navigator patterns specified in the project properties.
If you leave a navigator empty, it's considered 'not there'. This is equal to deleting a navigator from the Project Explorer. It's recommended to have both navigators defined for all relationships unless you want to have a single-sided relationship. In that case, at least define the navigator for the foreign key side of the relationship.
When you're doing specifying the relationship, you can click OK to create the many to many relationship.
Note: |
Many to many relationships with an intermediate entity with non-pk fields are only supported on the LLBLGen Pro RTL target framework. Linq to Sql doesn't support many to many relationships. On the Entity Framework and NHibernate the LLBLGen Pro designer only supports 'pure' many to many relationships, where the intermediate entity only consists of foreign key fields. If you define a non-pure many to many relationship while having one of these target frameworks as the target framework of your project, they're ignored. |