Partilhar via


EntityContainerMapping Element (MSL)

The EntityContainerMapping element in mapping specification language (MSL) maps the entity container in the conceptual model to the entity container in the storage model. The EntityContainerMapping element is a child of the Mapping element.

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

Applicable Attributes

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

Attribute Name Is Required Value

StorageModelContainer

Yes

The name of the storage model entity container that is being mapped.

CdmEntityContainer

Yes

The name of the conceptual model entity container that is being mapped.

GenerateUpdateViews

No

True or False. If False, no update views are generated. This attribute should be set to False when you have a read-only mapping that would be invalid because data may not round-trip successfully.

The default value is True.

Example

The following example shows an EntityContainerMapping element that maps the SchoolModelEntities container (the conceptual model entity container) to the SchoolModelStoreContainer container (the storage model entity container):

<EntityContainerMapping StorageEntityContainer="SchoolModelStoreContainer" 
                        CdmEntityContainer="SchoolModelEntities">
  <EntitySetMapping Name="Courses">
    <EntityTypeMapping TypeName="c.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>
  <EntitySetMapping Name="Departments">
    <EntityTypeMapping TypeName="c.Department">
      <MappingFragment StoreEntitySet="Department">
        <ScalarProperty Name="DepartmentID" ColumnName="DepartmentID" />
        <ScalarProperty Name="Name" ColumnName="Name" />
        <ScalarProperty Name="Budget" ColumnName="Budget" />
        <ScalarProperty Name="StartDate" ColumnName="StartDate" />
        <ScalarProperty Name="Administrator" ColumnName="Administrator" />
      </MappingFragment>
    </EntityTypeMapping>
  </EntitySetMapping>
</EntityContainerMapping>

See Also

Concepts

CSDL Specification
SSDL Specification

Other Resources

Modeling and Mapping