An association type (also called an association) is the fundamental building block for describing relationships in the Entity Data Model (EDM). In a conceptual model, an association represents a relationship between two entity types (such as
Order). In an application, an instance of an association represents a specific association (such as an association between an instance of
Customer and an instance of
Order). Association instances are logically grouped in an association set.
An association definition contains the following information:
A unique name. (Required)
Two association ends, one for each entity type in the relationship. (Required)
An association cannot represent a relationship among more than two entity types. An association can, however, define a self-relationship by specifying the same entity type for each of its association ends.
A referential integrity constraint. (Optional)
Each association end must specify an association end multiplicity that indicates the number of entity type instances that can be at one end of the association. An association end multiplicity can have a value of one (1), zero or one (0..1), or many (*). Entity type instances at one end of an association can be accessed through navigation properties or foreign keys if they are exposed on an entity type. For more information, see Entity Data Model: Foreign Keys.
The diagram below shows a conceptual model with two associations:
WrittenBy. The association ends for the
PublishedBy association are the
Publisher entity types. The multiplicity of the
Publisher end is one (1) and the multiplicity of the
Book end is many (*), indicating that a publisher publishes many books and a book is published by one publisher.
The ADO.NET Entity Framework uses a domain-specific language (DSL) called conceptual schema definition language (CSDL) to define conceptual models. The following CSDL defines the
PublishedBy association shown in the diagram above:
<Association Name="PublishedBy"> <End Type="BooksModel.Book" Role="Book" Multiplicity="*" /> <End Type="BooksModel.Publisher" Role="Publisher" Multiplicity="1" /> </Association>