# association set end

An association set end identifies the entity type and the entity set at the end of an association set. Association set ends are defined as part of an association set; an association set must have exactly two association set ends.

An association set end definition contains the following information:

• One of the entity types involved in the association set. (Required)

• The entity set for the entity type involved in the association set. (Required)

## Example

The diagram below shows a conceptual model with two associations: WrittenBy and PublishedBy.

The following diagram shows an association set (PublishedBy) and two entity sets (Books and Publishers) based on the conceptual model shown above. The association set ends are the Books and Publishers entity sets. Bi in the Books entity set represents an instance of the Book entity type at run time. Similarly, Pj represents a Publisher instance in the Publishers entity set. BiPj represents an instance of the PublishedBy association in the PublishedBy association set.

The ADO.NET Entity Framework uses a DSL called conceptual schema definition language (CSDL) to define conceptual models. The following CSDL defines an entity container with one association set for each association in the diagram above. Note that association set ends are defined as part of each association set definition.

<EntityContainer Name="BooksContainer" >
<EntitySet Name="Books" EntityType="BooksModel.Book" />
<EntitySet Name="Publishers" EntityType="BooksModel.Publisher" />
<EntitySet Name="Authors" EntityType="BooksModel.Author" />
<AssociationSet Name="PublishedBy" Association="BooksModel.PublishedBy">
<End Role="Book" EntitySet="Books" />
<End Role="Publisher" EntitySet="Publishers" />
</AssociationSet>
<AssociationSet Name="WrittenBy" Association="BooksModel.WrittenBy">
<End Role="Book" EntitySet="Books" />
<End Role="Author" EntitySet="Authors" />
</AssociationSet>
</EntityContainer>