Sdílet prostřednictvím


association end (Entity Data Model)

An association end identifies the entity type on one end of an association and the number of entity type instances that can exist at that end of an association. Association ends are defined as part of an association; an association must have exactly two association ends. Navigation properties allow for navigation from one association end to the other.

An association end definition contains the following information:

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

    NoteNote:

    For a given association, the entity type specified for each association end can be the same. This creates a self-association.

  • 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 (*).

  • A name for the association end. (Optional)

  • Information about operations that are performed on the association end, such as cascade on delete. (Optional)

Example

The diagram below shows a conceptual model with two associations: PublishedBy and WrittenBy. The association ends for the PublishedBy association are the Book and 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.

Ee382824.ExampleModel(en-us,VS.100).gif

The ADO.NET Entity Framework uses a domain-specific language (DSL) called conceptual schema definition language (CSDL) to define conceptual models. The CSDL below defines the PublishedBy association shown in the diagram above. Note that the type, name, and multiplicity of each association end are specified by XML attributes (the Type, Role, and Multiplicity attributes, respectively). Optional information about operations performed on an end is specified in an XML element (the OnDelete element). In this case, if a publisher is deleted, so are all associated books.

        <Association Name="PublishedBy">
          <End Type="BooksModel.Book" Role="Book" Multiplicity="*" />
          <End Type="BooksModel.Publisher" Role="Publisher" Multiplicity="1" >
        <OnDelete Action="Cascade" />
      </End>
        </Association>

See Also

Concepts

Entity Data Model Key Concepts

Entity Data Model