Share via


AssociationSetMapping Element (MSL)

The AssociationSetMapping element in mapping specification language (MSL) defines the mapping between an association in the conceptual model and table columns in the underlying database.

Associations in the conceptual model are types whose properties represent primary and foreign key columns in the underlying database. The AssociationSetMapping element uses two EndProperty elements to define the mappings between association type properties and columns in the database. You can place conditions on these mappings with the Condition element. Map the insert, update, and delete functions for associations to stored procedures in the database with the ModificationFunctionMapping element. Define read-only mappings between associations and table columns by using an Entity SQL string in a QueryView element.

Note

If a referential constraint is defined for an association in the conceptual model, the association does not need to be mapped with an AssociationSetMapping element. If an AssociationSetMapping element is present for an association that has a referential constraint, the mappings defined in the AssociationSetMapping element will be ignored. For more information, see ReferentialConstraint Element (CSDL).

The AssociationSetMapping element can have the following child elements

Applicable Attributes

The following table describes the attributes that can be applied to the AssociationSetMapping element.

Attribute Name Is Required Value

Name

Yes

The name of the conceptual model association set that is being mapped.

TypeName

No

The namespace-qualified name of the conceptual model association type that is being mapped.

StoreEntitySet

No

The name of the table that is being mapped.

Example

The following example shows an AssociationSetMapping element in which the FK_Course_Department association set in the conceptual model is mapped to the Course table in the database. Mappings between association type properties and table columns are specified in child EndProperty elements.

<AssociationSetMapping Name="FK_Course_Department" 
                       TypeName="SchoolModel.FK_Course_Department" 
                       StoreEntitySet="Course">
  <EndProperty Name="Department">
    <ScalarProperty Name="DepartmentID" ColumnName="DepartmentID" />
  </EndProperty>
  <EndProperty Name="Course">
    <ScalarProperty Name="CourseID" ColumnName="CourseID" />
  </EndProperty>
</AssociationSetMapping>

See Also

Concepts

CSDL Specification
SSDL Specification
Association Element (CSDL)
AssociationSet Element (CSDL)
Association Element (SSDL)
AssociationSet Element (SSDL)
EntitySet Element (SSDL)

Other Resources

Modeling and Mapping