Freigeben über


Storage Metadata Schema (SSDL)

The storage metadata schema is a formal description of the database that persists data for an application built on the Entity Data Model (EDM). The entities and associations declared in this schema are the basis for mapping entities and associations in the conceptual schema to the corresponding entities in the storage model.

An entity declared in store schema definition language (SSDL) is very similar to an entity in conceptual schema definition language (CSDL). The difference is primarily in the data types that are used in SSDL declarations. Data types of properties declared in SSDL files are those of the storage model. Data types in CSDL files are simple types defined by the EDM. Mapping between these types is one of the functions of the EDM. For more information about the data types that are used in CSDL and SSDL, see Simple Types (EDM).

Metadata and Mapping

The namespace name and entity container declared in SSDL schema is metadata used by the mapping specification to connect tables in storage to entities in the CSDL schema.

Note

SSDL namespaces are different from XML namespaces. SSDL namespaces are used to fully qualify entity type names and association names. For example, when mapping specification language (MSL) refers to entity types, the fully qualified name must be provided. SSDL is in the XML namespace https://schemas.microsoft.com/ado/2006/04/edm/ssdl. The two types of namespaces are separate and distinct, and should not be confused.

The following lines in the Human Resources SSDL schema declare a namespace for the metadata that is contained by this schema. The namespace name will be used by the mapping specification language (MSL).

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

The SSDL schema includes an EntityContainer element that will also be used by the mapping specification. The following SSDL segment shows the declaration of the entity container.

  <EntityContainer Name="HumanResources">
    <EntitySet Name="Department" EntityType="Self.Department" />
    <EntitySet Name="Employee" EntityType="Self.Employee" />
    <EntitySet Name="EmployeeAddress" EntityType="Self.EmployeeAddress" />
    <EntitySet Name="EmployeeDepartmentHistory"
                      EntityType="Self.EmployeeDepartmentHistory" />
    <EntitySet Name="EmployeePayHistory"
                             EntityType="Self.EmployeePayHistory" />
    <EntitySet Name="JobCandidate" EntityType="Self.JobCandidate" />
    <EntitySet Name="Shift" EntityType="Self.Shift" />
    <AssociationSet Name="FK_Employee_Employee_ManagerID"
                  Association="Self.FK_Employee_Employee_ManagerID">
      <End Role="Employee" EntitySet="Employee" />
      <End Role="Employee63" EntitySet="Employee" />
    </AssociationSet>
    <AssociationSet Name="FK_JobCandidate_Employee_EmployeeID" 
            Association="Self.FK_JobCandidate_Employee_EmployeeID">
      <End Role="Employee" EntitySet="Employee" />
      <End Role="JobCandidate" EntitySet="JobCandidate" />
    </AssociationSet>
  </EntityContainer>

Entities and associations in the SSDL metadata specify tables and columns in the storage model. This metadata is needed for mapping between entities in the CSDL schema and in storage.

The EntityContainer elements in the conceptual schema and in the storage schema are independent of the Schema element even though they are contained by Schema element. The EntityContainerMapping element in the MSL maps the EntityContainer of the SSDL file to an EntityContainer in the CSDL file without references to the namespace names declared in each schema: edm:CdmEntityContainer="HumanResources" edm:StorageEntityContainer="HumanResources".

The following MSL heading shows the mapping between the HumanResources entity container in the conceptual schema, here referred to as CdmEntityContainer, and the storage metadata, referred to as StorageEntityContainer.

<?xml version="1.0" encoding="utf-8"?>
<Mapping edm:Space="C-S" 
    xmlns="urn:schemas-microsoft-com:windows:storage:mapping:CS">
  < EntityContainerMapping
                  CdmEntityContainer="HumanResources"
                  StorageEntityContainer="HumanResources">

The SSDL syntax used in the examples in this topic is more fully described in the following topics:

Schema Element (SSDL)

See Also

Concepts

Entity Data Model Types
AdventureWorks Complete Model (EDM)