实体数据模型 (EDM) 中,MappingFragment 元素指定存储中的表,该表对应于映射规范的 EntityTypeMapping 元素的 TypeName 属性指定的 EntityType。
下面的示例演示 AdventureWorksHRModel 命名空间中的 Department 实体映射。MappingFragment 元素标识存储架构中名为 Department 的 StoreEntitySet。Department 实体的每个属性 (Property) 在 MappingFragment 元素的 ScalarProperty 和 ColumnName 属性 (Attribute) 中映射到表的某列。
      <EntityTypeMapping
                  TypeName="AdventureWorksHRModel.Department">
        <MappingFragment StoreEntitySet="Department">
          <ScalarProperty Name="DepartmentID"
                                 ColumnName="DepartmentID" />
          <ScalarProperty Name="Name" ColumnName="Name" />
          <ScalarProperty Name="GroupName"
                                     ColumnName="GroupName" />
          <ScalarProperty Name="ModifiedDate"
                                 ColumnName="ModifiedDate" />
        </MappingFragment>
      </EntityTypeMapping>
另请参见
概念
ScalarProperty 元素 (MSL)
ColumnName 属性 (ScalarProperty MSL)
EntitySetMapping 元素 (MSL)
EntityContainerMapping 元素 (MSL)
AdventureWorks 完整模型 (EDM)