This documentation is archived and is not being maintained.

AssociationEnd Element (MSL)

The AssociationEnd element in mapping specification language (MSL) is used when the modification functions of an entity type in the conceptual model are mapped to stored procedures in the underlying database. If a modification stored procedure takes a parameter whose value is held in an association property, the AssociationEnd element maps the property value to the parameter. For more information, see the example below.

For more information about mapping modification functions of entity types to stored procedures, see ModificationFunctionMapping Element (MSL) and Walkthrough: Mapping an Entity to Stored Procedures.

The AssociationEnd element can have the following child elements:

Applicable Attributes

The following table describes the attributes that are applicable to the AssociationEnd element.

Attribute Name Is Required Value



The name of the association that is being mapped.



The value of the FromRole attribute of the navigation property that corresponds to the association being mapped. For more information, see NavigationProperty Element (CSDL).



The value of the ToRole attribute of the navigation property that corresponds to the association being mapped. For more information, see NavigationProperty Element (CSDL).


Consider the following conceptual model entity type:

<EntityType Name="Course">
    <PropertyRef Name="CourseID" />
  <Property Type="Int32" Name="CourseID" Nullable="false" />
  <Property Type="String" Name="Title" Nullable="false" MaxLength="100" 
            FixedLength="false" Unicode="true" />
  <Property Type="Int32" Name="Credits" Nullable="false" />
  <NavigationProperty Name="Department" 
                      FromRole="Course" ToRole="Department" />

Also consider the following stored procedure:

CREATE PROCEDURE [dbo].[UpdateCourse]
		@CourseID int,
		@Title nvarchar(50),
		@Credits int,
		@DepartmentID int
		UPDATE Course SET Title=@Title, 
		WHERE CourseID=@CourseID;

In order to map the update function of the Course entity to this stored procedure, you must supply a value to the DepartmentID parameter. The value for DepartmentID does not correspond to a property on the entity type; it is contained in an independent association whose mapping is shown here:

<AssociationSetMapping Name="FK_Course_Department" 
  <EndProperty Name="Course">
    <ScalarProperty Name="CourseID" ColumnName="CourseID" />
  <EndProperty Name="Department">
    <ScalarProperty Name="DepartmentID" ColumnName="DepartmentID" />

The following code shows the AssociationEnd element used to map the DepartmentID property of the FK_Course_Department association to the UpdateCourse stored procedure (to which the update function of the Course entity type is mapped):

<EntitySetMapping Name="Courses">
  <EntityTypeMapping TypeName="SchoolModel.Course">
    <MappingFragment StoreEntitySet="Course">
      <ScalarProperty Name="Credits" ColumnName="Credits" />
      <ScalarProperty Name="Title" ColumnName="Title" />
      <ScalarProperty Name="CourseID" ColumnName="CourseID" />
  <EntityTypeMapping TypeName="SchoolModel.Course">
      <UpdateFunction FunctionName="SchoolModel.Store.UpdateCourse">
        <AssociationEnd AssociationSet="FK_Course_Department" 
                        From="Course" To="Department">
          <ScalarProperty Name="DepartmentID" 
                          Version="Current" />
        <ScalarProperty Name="Credits" ParameterName="Credits" 
                        Version="Current" />
        <ScalarProperty Name="Title" ParameterName="Title" 
                        Version="Current" />
        <ScalarProperty Name="CourseID" ParameterName="CourseID" 
                        Version="Current" />

See Also