MappingFragment Element (MSL)
The MappingFragment element in mapping specification language (MSL) defines the mapping between the properties of a conceptual model entity type and a table or view in the database. For information about conceptual model entity types and underlying database tables or views, see EntityType Element (CSDL) and EntitySet Element (SSDL). The MappingFragment can be a child element of the EntityTypeMapping element or the EntitySetMapping element.
The MappingFragment element can have the following child elements:
ComplexType (zero or more)
ScalarProperty (zero or more)
Condition (zero or more)
Applicable Attributes
The following table describes the attributes that can be applied to the MappingFragment element.
Attribute Name | Is Required | Value |
---|---|---|
StoreEntitySet |
Yes |
The name of the table or view that is being mapped. |
MakeColumnsDistinct |
No |
True or False depending on whether only distinct rows are returned. If this attribute is set to True, the GenerateUpdateViews attribute of the EntityContainerMapping element must be set to False. |
Example
The following example shows a MappingFragment element as the child of an EntityTypeMapping element. In this example, properties of the Course type in the conceptual model are mapped to columns of the Course table in the database.
<EntitySetMapping Name="Courses">
<EntityTypeMapping TypeName="SchoolModel.Course">
<MappingFragment StoreEntitySet="Course">
<ScalarProperty Name="CourseID" ColumnName="CourseID" />
<ScalarProperty Name="Title" ColumnName="Title" />
<ScalarProperty Name="Credits" ColumnName="Credits" />
<ScalarProperty Name="DepartmentID" ColumnName="DepartmentID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
Example
The following example shows a MappingFragment element as the child of an EntitySetMapping element. As in the example above, properties of the Course type in the conceptual model are mapped to columns of the Course table in the database.
<EntitySetMapping Name="Courses" TypeName="SchoolModel.Course">
<MappingFragment StoreEntitySet="Course">
<ScalarProperty Name="CourseID" ColumnName="CourseID" />
<ScalarProperty Name="Title" ColumnName="Title" />
<ScalarProperty Name="Credits" ColumnName="Credits" />
<ScalarProperty Name="DepartmentID" ColumnName="DepartmentID" />
</MappingFragment>
</EntitySetMapping>
See Also
Concepts
CSDL Specification
SSDL Specification