Freigeben über


2.1.8 Association

An Association element defines a peer-to-peer relationship between participating EntityType elements and can support different multiplicities at the two ends. OnDelete operational behavior can be specified at any end of the relationship. An association type can be categorized as an EDM type.

An example of an association is the relationship between the Customer and Order entities. Typically, this relationship has the following characteristics:

  • Multiplicity: Each Order is associated with exactly one Customer. Every Customer has zero or more Orders.

  • Operational behavior: OnDelete Cascade; when an Order with one or more OrderLines is deleted, the corresponding OrderLines also get deleted.

The following is an example of an Association element.

   <Association Name="CustomerOrder">
     <End Type="Model1.Customer" Role="Customer" Multiplicity="1" />
     <End Type="Model1.Order" Role="Order" Multiplicity="*" />
   </Association>

The following rules apply to the Association element:

  • Association MUST have a Name attribute defined. The Name attribute is of type SimpleIdentifier.

  • An Association is a schema level named element and has a unique name.

  • Association can contain any number of AnnotationAttribute attributes. The full names of AnnotationAttribute cannot collide.

  • An Association element can contain a maximum of one Documentation element.

  • Association MUST have exactly two End elements defined.

  • Association can have one ReferentialConstraint element defined.

  • Association can contain any number of AnnotationElement elements.

  • Child elements of Association are to appear in this sequence: Documentation, End, ReferentialConstraint, AnnotationElement.

Graphic representation in table format of the rules that apply to the Association element.

All child elements are to appear in the order indicated.