Edit

Share via


Table relationship definitions

When you look at the solution explorer or the three relationship collections in the EntityMetadata, you might think that there are three types of relationships. Actually, there are only two types, as shown in the following table.

Relationship Type Description
One-to-Many
OneToManyRelationshipMetadata
A relationship where one record for the Primary Table can be associated to many other Related Table records because of a lookup column on the related table.
When viewing a primary table record you can see a list of the related table records that are associated with it.
Many-to-Many
ManyToManyRelationshipMetadata
A relationship that depends on a special Relationship Table, sometimes called an Intersect table, so that many records of one table can be related to many records of another table.
When viewing records of either table in a Many-to-Many relationship you can see a list of any records of the other table that are related to it.

The EntityMetadata.ManyToOneRelationships collection contains OneToManyRelationshipMetadata types. One-to-Many relationships exist between tables and refer to each table as either a Primary Table or Related Table. The related table, sometimes called the child table, has a lookup column that allows storing a reference to a record from the primary table, sometimes called the parent table. A Many-to-One relationship is just a One-to-Many relationship viewed from the related table.

Note

Although related tables are sometimes called child tables, don't confuse these tables with Child tables, which refers to how security is applied to related tables.

More information: Create relationships between tables.

Cascade configuration

When a one-to-many relationship exists, configure cascading behaviors to preserve data integrity and automate business processes. More information: Configure relationship cascading behavior.

Create a hierarchy of tables

Within a self-referential one-to-many relationship, set the hierarchy by setting the IsHierarchical property to true.

By using model-driven apps, you can view and interact with the hierarchy.

For developers, this property enables new types of queries based on the hierarchy by using the Under and Not Under operators.

For more information, see Query and visualize hierarchically related data.

See also

Dataverse tables