ComponentOne DataObjects for .NET
Composite Relations
DataObjects for .NET (Enterprise Edition) > Schema Objects > Composite Relations

A composite relation (class CompositeRelation) defines a parent-child relationship between two tables one of which is a composite table. See Simple Relations about parent-child relationships between tables. If both parent and child are simple tables, we use a simple relation to connect them. If at least one of them, or both, are composite tables, we use a composite relation.

A composite relation is based on a simple relation connecting one of the parent's constituent tables to one of the child's constituent tables, as in the following figure:


More exactly, it connects one of the parent's table views to one of the child's table views. The distinction between simple tables and table views must be made because a composite table can have multiple table views (CompositeDefView objects) based on the same table in its diagram. In this case, we need to know which of the table views actually participates in the relation.

Creating a composite relation starts in exactly the same manner as creating a simple relation. When you set either the relation's Parent or Child property to a composite table, the relation will become a composite relation.

When you set both Parent and Child of a composite relation, the Schema Designer looks for a simple relation connecting a parent's table view with a child's table view. If one is found, and if it is the only one possible simple relation, the SimpleRelation property is automatically set to this simple relation. If more than one simple relation is possible, the SimpleRelation property will not be set automatically, you will need to open the property combo box and select one of the applicable simple relations.

Once you select a SimpleRelation (or it is set automatically), the Schema Designer sets the properties ParentTableView and ChildTableView to the parent's and child's table views connected by the simple relation. This, however, is done only if the choice of such table views is unambiguous, that is, if both parent and child composite tables have only one table view based on the corresponding table. If the choice is non-trivial, that is, there is more than one table view to choose from, the properties ParentTableView/ ChildTableView are not set automatically; you will need to choose a table view in the property combo box.