次の方法で共有


EntityType Element (SSDL)

In the Entity Data Model (EDM), the EntityType element is used in store schema definition language (SSDL) to define metadata about entities in the storage model used by an EDM application.

The namespace AdventureWorksHRTarget in the following example contains a storage entity for the human resources Department table. The properties of the Department entity are declared and defined in the following SSDL schema excerpt.

<?xml version="1.0" encoding="utf-8"?>
<Schema Namespace="AdventureWorksHRTarget" Alias="Self"
          xmlns="https://schemas.microsoft.com/ado/2006/04/edm/ssdl">

  <EntityType Name="Department" >
    <Key>
        <PropertyRef Name="DepartmentID">
    </Key>
    <Property Name="DepartmentID" Type="smallint" Nullable="false"
                                 StoreGeneratedPattern="Identity" />
    <Property Name="Name" Type="nvarchar" Nullable="false"
                                                   MaxLength="50" />
    <Property Name="GroupName" Type="nvarchar" Nullable="false"
                                                   MaxLength="50" />
    <Property Name="ModifiedDate" Type="datetime" Nullable="false" />
  </EntityType>

The Department entity in the target database specifies a Key property similar to the Key property in the conceptual schema definition language (CSDL) declaration. The entity in the storage model schema is also named Department. Because the database stores instances of entities defined in the CSDL schema, this entity requires a Key property in metadata that corresponds to the primary key in the data table.

In this SSDL schema, the data type of the Key property is smallint, which is a SQL Server data type. The parallel Department entity in the CSDL file uses the data type Int16, a primitive type defined by the EDM.

The data types of the Name and GroupName properties in this storage entity are both nvarchar, the SQL Server data type for an array of variable-length UNICODE characters. SSDL syntax indicates MaxLength of 50 characters, which corresponds to the database specification.

The property ModifiedDate is of type DateTime in both CSDL and SSDL.

See Also

Concepts

EntityType Element (CSDL)
EntityTypeMapping Element (EntitySetMapping)
EntityContainerMapping Element (MSL)
AdventureWorks Complete Model (EDM)
Simple Types (EDM)

Other Resources

EDM Specifications