Compartir a través de


ComplexType (CSDL)

Within the Entity Data Model, the complex type in conceptual schema definition language (CSDL) defines a data type with internal structure but without a key property. The complex type is used to implement a property that has internal properties of its own.

Either an entity or a complex type can declare a property as complex type. This property must be mapped as a complex property in the mapping specification.

The Address property in the following example is implemented as complex type and used as a property of the CCustomer entity.

<EntityType Name="CCustomer">
          <Key>
            <PropertyRef Name="CustomerId" />
          </Key>
          <Property Name="CustomerId" Type="Int32" Nullable="false" />
          <Property Name="CompanyName" Type="String" />
          <Property Name="ContactName" Type="String" />
          <Property Name="ContactTitle" Type="String" />
          <Property Name="Address" Type="Self.CAddress" Nullable="false" />
        </EntityType>

        <ComplexType Name="CAddress">
          <Property Name="StreetAddress" Type="String" />
          <Property Name="City" Type="String" />
          <Property Name="Region" Type="String" />
          <Property Name="PostalCode" Type="String" />
          <Property Name="Country" Type="String" />
          <Property Name="Phone" Type="String" />
          <Property Name="Fax" Type="String" />
        </ComplexType>

See Also

Concepts

Complex Type (EDM)
ComplexType (SSDL)
ComplexType (MSL)