Partager via


Élément Schema (CSDL)

Dans le modèle EDM (Modèle de données d'entité), l'élément Schema est l'élément racine d'un schéma conceptuel. Il représente la spécification du Namespace qui contient les entités et les associations utilisées par le modèle objet qui est défini. Le schéma conceptuel est défini dans le langage CSDL (Conceptual Schema Definition Language). Les éléments EntityType et Association du schéma conceptuel sont des éléments enfants de l'élément Schema.

L'élément EntityContainer est la spécification d'une classe dans le modèle objet en cours de conception. EntitySet et AssociationSet sont des éléments enfants de EntityContainer.

Pour plus d'informations sur les éléments EntityType et Association, voir les sous-rubriques de cette section. Pour plus d'informations sur l'élément EntityContainer , voir Élément EntityContainer (CSDL).

La déclaration de schéma suivante montre l'élément Schema et ses éléments enfants.

<Schema Namespace="AdventureWorksHRModel" Alias="Self" 
             xmlns="https://schemas.microsoft.com/ado/2006/04/edm">

  <EntityType Name="Department" 
    <Key>
        <PropertyRef Name="DepartmentID" />
    </Key>
    <Property Name="DepartmentID" Type="Int16" Nullable="false" />
    <Property Name="Name" Type="String" Nullable="false" />
    <Property Name="GroupName" Type="String" Nullable="false" />
    <Property Name="ModifiedDate" Type="DateTime" Nullable="false" />
  </EntityType>

  <EntityType Name="Employee"
    <Key>
        <PropertyRef Name=EmployeeID>
    </Key>
    <Property Name="EmployeeID" Type="Int32" Nullable="false" />
    <Property Name="NationalIDNumber" Type="String" Nullable="false" />
    <Property Name="ContactID" Type="Int32" Nullable="false" />
    <Property Name="LoginID" Type="String" Nullable="false"/>
    <Property Name="Title" Type="String" Nullable="false" />
    <Property Name="BirthDate" Type="DateTime" Nullable="false" />
    <Property Name="MaritalStatus" Type="String" Nullable="false"
/>
    <Property Name="Gender" Type="String" Nullable="false"/>
    <Property Name="HireDate" Type="DateTime" Nullable="false" />
    <Property Name="SalariedFlag" Type="Boolean" Nullable="false" />
    <Property Name="VacationHours" Type="Int16" Nullable="false" />
    <Property Name="SickLeaveHours" Type="Int16" Nullable="false" />
    <Property Name="CurrentFlag" Type="Boolean" Nullable="false" />
    <Property Name="rowguid" Type="Guid" Nullable="false" />
    <Property Name="ModifiedDate" Type="DateTime" Nullable="false" />
  </EntityType>

  <Association Name="Employee_EmployeeManagerID">
        <End Role="Employee" Type="Self.Employee" Multiplicity="0..1" />
        <End Role="Employee" Type="Self.Employee" Multiplicity="0..*" />
  </Association>

  <EntityContainer Name="HumanResources">
    <EntitySet Name="Department" EntityType="Self.Department" />
    <EntitySet Name="Employee" EntityType="Self.Employee" />
    <AssociationSet Name="Employee_EmployeeManagerID"
                    Association="Self.Employee_EmployeeManagerID">
      <End Role="Employee" EntitySet="Employee" />
       <End Role="Employee63" EntitySet="Employee" />
    </AssociationSet>
  </EntityContainer>

</Schema>

Les spécifications de schéma CSDL sont mappées aux spécifications SSDL (Store Schema Definition Language) dans le langage MSL (Mapping Specification Language).

Dans cette section

Les rubriques de cette section décrivent les types et les éléments utilisés pour implémenter un modèle objet généré sur le modèle EDM. L'attribut Namespace de l'élément Schema et les éléments enfants de l'élément Schema, comme EntityType et Association, sont décrits dans les rubriques suivantes :

Attribut Namespace (CSDL)

Élément EntityType (CSDL)

Élément Association (CSDL)

Chacun de ces types a des éléments enfants dans le schéma CSDL.

Voir aussi

Concepts

Élément EntityContainer (CSDL)
Implémentation d'entités (EDM)
Implémentation d'associations (EDM)

Autres ressources

Spécifications EDM