Databases Reference
In-Depth Information
The mapping model connects the storage and conceptual models and allows for some
degree of differences between them. The Mapping Details tool window shows the
mapping information for the entity, currently selected in the Entity Designer or the Model
Browser window. Figure 2.11 shows an example of the mapping for the Product entity.
FIGURE 2.11 Mapping model.
The Mapping Details window shows the database table to which the currently selected
entity type is mapped, followed by a list of column mappings, with database columns
listed on the left side and the entity properties shown on the right. In this example, the
entire entity model is reverse-engineered from an existing Northwind sample database, so
the storage and conceptual models are nearly identical, making the mapping very
straightforward. However, if you want to customize the conceptual model, you can
configure the entity mapping manually.
The underlying XML representation of the mapping model fairly closely matches what
the Mapping Details window displays. Following is the mapping of the Product entity
type to the Products table of the Northwind database:
<EntityTypeMapping TypeName=”NorthwindModel.Product”>
<MappingFragment StoreEntitySet=”Products”>
<ScalarProperty Name=”ProductID” ColumnName=”ProductID” />
<ScalarProperty Name=”ProductName” ColumnName=”ProductName” />
<ScalarProperty Name=”SupplierID” ColumnName=”SupplierID” />
<ScalarProperty Name=”CategoryID” ColumnName=”CategoryID” />
<ScalarProperty Name=”QuantityPerUnit” ColumnName=”QuantityPerUnit” />
<ScalarProperty Name=”UnitPrice” ColumnName=”UnitPrice” />
<ScalarProperty Name=”UnitsInStock” ColumnName=”UnitsInStock” />
<ScalarProperty Name=”UnitsOnOrder” ColumnName=”UnitsOnOrder” />
<ScalarProperty Name=”ReorderLevel” ColumnName=”ReorderLevel” />
<ScalarProperty Name=”Discontinued” ColumnName=”Discontinued” />
</MappingFragment>
</EntityTypeMapping>
 
Search WWH ::




Custom Search