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

A simple relation (class SimpleRelation) is an object establishing a parent-child relationship between two simple tables. The concept of relationship is common in database modeling. It is reflected in a database structure, for example, by foreign key relationships where the primary key of one table (parent) corresponds to a foreign key of another table (child).

A simple relation relates the two tables by creating a correspondence between a field (or several fields) of the parent table (parent fields) and a field (or several fields, the same number of fields as in parent) of the child table (child fields). For example, in a Customers – Orders relation, the Customers table is the child and the Orders table is the parent. They are related by the equality


Customers.CustomerID = Orders.CustomerID

where Customers.CustomerID is the parent field and Orders.CustomerID is the child field.

For each parent (Customers) row there can be multiple child (Orders) rows with the same value of the CustomerID field. For each child (Orders) row there is only one parent (Customers) row with the same value of the CustomerID field. This is why this is a one-to-many relation (one parent row to many child rows), which is represented by the following notation:


Customers Orders

We can also define an Orders – Customers relation where Orders is the parent and Customers is the child. This will be a many-to-one relation:


Orders Customers

In a many to one relation, there is only one child row for each parent row, and there can be many parent rows for a child row.

See Also