Share via


ComplexType (MSL)

In the Entity Data Model (EDM), the mapping specification language (MSL) for a complex type maps the properties of a type defined in the conceptual schema to those of a type in the storage schema. In MSL, the properties of a conceptual type are similar to the scalar property mappings of an entity. The ComplexProperty element tags surround the scalar property mappings.

The following mapping schema shows the mapping of Address as a complex property.

 <Mapping Space="C-S"
      xmlns="urn:schemas-microsoft-com:windows:storage:mapping:CS">

    <EntityContainerMapping StorageEntityContainer="dbo"
                   CdmEntityContainer="CustomerComplexAddressContext">

      <EntitySetMapping Name="CCustomers"
               StoreEntitySet="SCustomer"
               TypeName="CustomerComplexAddress.CCustomer">
        <ScalarProperty Name="CustomerId" ColumnName="CustomerId" />
        <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
        <ScalarProperty Name="ContactName" ColumnName="ContactName" />
        <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
        <ComplexProperty Name="Address"
                     TypeName="CustomerComplexAddress.CAddress">
          <ScalarProperty Name="StreetAddress" ColumnName="Address" />
          <ScalarProperty Name="City" ColumnName="City" />
          <ScalarProperty Name="Region" ColumnName="Region" />
          <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
          <ScalarProperty Name="Country" ColumnName="Country" />
          <ScalarProperty Name="Phone" ColumnName="Phone" />
          <ScalarProperty Name="Fax" ColumnName="Fax" />
        </ComplexProperty>
      </EntitySetMapping>
    </EntityContainerMapping>
 </Mapping>

See Also

Tasks

How to: Create and Execute Object Queries with Complex Types (Entity Framework)

Concepts

ComplexType (CSDL)
ComplexType (SSDL)