AssociationSet Element (CSDL)

The AssociationSet element in conceptual schema definition language (CSDL) is a logical container for association instances of the same type. An association set provides a definition for grouping association instances so that they can be mapped to a data source. For more information about mapping, see AssociationSetMapping Element (MSL).

The AssociationSet element can have the following child elements (in the order listed):

The Association attribute specifies the type of association that an association set contains. The entity sets that make up the ends of an association set are specified with exactly two child End elements.

Applicable Attributes

The table below describes the attributes that can be applied to the AssociationSet element.

Attribute Name Is Required Value

Name

Yes

The name of the entity set. The value of the Name attribute cannot be the same as the value of the Association attribute.

Association

Yes

The fully-qualified name of the association that the association set contains instances of. The association must be in the same namespace as the association set.

Bb386894.note(en-us,VS.100).gifNote:
Any number of annotation attributes (custom XML attributes) may be applied to the AssociationSet element. However, custom attributes may not belong to any XML namespace that is reserved for CSDL. The fully-qualified names for any two custom attributes cannot be the same.

Example

The following example shows an EntityContainer element with two AssociationSet elements:

<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>

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2015 Microsoft