Compartir a través de


Elemento Schema (CSDL)

El elemento Schema es el elemento raíz de un esquema conceptual de Entity Data Model (EDM). El elemento Schema es la especificación para el Namespace que contiene las entidades y asociaciones que usa el modelo de objetos que se define. El esquema conceptual se define en el lenguaje de definición de esquemas conceptuales (CSDL). Los elementos EntityType y Association del esquema conceptual son elementos secundarios del elemento Schema.

El elemento EntityContainer es la especificación para una clase en el modelo de objetos que se diseña. EntitySet y AssociationSet son elementos secundarios de EntityContainer.

Para obtener más información sobre los elementos EntityType y Association, vea los temas secundarios de esta sección. Para más información sobre el elemento EntityContainer , vea Elemento EntityContainer (CSDL).

La siguiente declaración de esquema muestra el elemento Schema y sus elementos secundarios.

<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>

Las especificaciones de esquemas de CSDL se asignan a las especificaciones del lenguaje de definición de esquemas de almacenamiento (SSDL) en el lenguaje de especificación de asignaciones (MSL).

En esta sección

Los temas de esta sección describen los tipos y elementos utilizados para implementar un modelo de objetos generado en el EDM. El atributo Namespace del elemento Schema y los elementos secundarios del elemento Schema, como EntityType y Association, se describen en los temas siguientes:

Atributo Namespace (CSDL)

Elemento EntityType (CSDL)

Elemento Association (CSDL)

Cada uno de estos tipos tiene elementos secundarios en el esquema de CSDL.

Vea también

Conceptos

Elemento EntityContainer (CSDL)
Implementar entidades (EDM)
Implementar asociaciones (EDM)

Otros recursos

Especificaciones del EDM