Northwind Storage Schema (EDM)

.NET Framework 3.5

Metadata describes the structure of a database used by an application built on the Entity Data Model (EDM). Metadata is defined in store schema definition language (SSDL). The following schema is the complete metadata specification for database tables that contain instances of the entities and associations defined in Northwind Conceptual Schema (EDM).

The schema starts with a specification of a target namespace: NorthwindLib.Target. This Namespace is used to identify the metadata in the mapping specification. Following the Namespace name, the <EntityContainer> tag specifies a name for the container the metadata describes. In this case, the database object is named dbo corresponding to the name of the partition identifier in the Northwind database.

Each of the entity types and entity sets previously defined in the conceptual schema definition language (CSDL) schema have EntityType and EntitySet specifications in the SSDL schema. The SSDL declarations describe the pre-existing tables that the CSDL adapted in its design specifications for entities and associations. In the SSDL schema, entity sets represent tables in the database. Instances of entity types are represented by rows in a table. The properties of entity types correspond to columns in the tables. The Key properties of SSDL types correspond to primary key columns of rows in database tables.

The following schema defines the storage metadata in the NorthwindLib.Target namespace.

<?xml version="1.0" encoding="utf-8"?>
<Schema xmlns:edm="" 
             Namespace="NorthwindLib.Target" Alias="Self" >

  <EntityType Name="Product">
      <PropertyRef Name="ProductID" />
    <Property Name="ProductID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
    <Property Name="ProductName" Type="nvarchar" Nullable="false" MaxLength="40" />
    <Property Name="CategoryID" Type="int" Nullable="true" />
    <Property Name="UnitPrice" Type="decimal" Nullable="true" Precision="10" Scale="4" />
    <Property Name="Discontinued" Type="bit" Nullable="false" />
    <Property Name="UnitsInStock" Type="smallint" Nullable="true" />

  <EntityType Name="Category">
      <PropertyRef Name="CategoryID" />
    <Property Name="CategoryID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
    <Property Name="CategoryName" Type="nvarchar" Nullable="false" MaxLength="15" />
    <Property Name="Description" Type="nvarchar" Nullable="true" MaxLength="255" />

  <EntityType Name="Customer">
      <PropertyRef Name="CustomerID" />
    <Property Name="CustomerID" Type="nchar" Nullable="false" MaxLength="5" />
    <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
    <Property Name="ContactName" Type="nvarchar" Nullable="true" MaxLength="30" />
    <Property Name="City" Type="nvarchar" Nullable="true" MaxLength="15" />
    <Property Name="Country" Type="nvarchar" Nullable="true" MaxLength="15" />

  <EntityType Name="Order">
      <PropertyRef Name="OrderID" />
    <Property Name="OrderID" Type="int" Nullable="false" />
    <Property Name="CustomerID" Type="nchar" Nullable="true" MaxLength="5" />
    <Property Name="OrderDate" Type="datetime" Nullable="true" />
    <Property Name="ShipCity" Type="nvarchar" Nullable="true" MaxLength="15" />
    <Property Name="ShipCountry" Type="nvarchar" Nullable="true" MaxLength="15" />

  <EntityContainer Name="dbo">
    <EntitySet Name="Categories" EntityType="Self.Category" Schema="dbo" Table="Categories" />
    <EntitySet Name="Products" EntityType="Self.Product" Schema="dbo" Table="Products" />
    <EntitySet Name="Customers" EntityType="Self.Customer" Schema="dbo" Table="Customers" />
    <EntitySet Name="Orders" EntityType="Self.Order" Schema="dbo" Table="Orders" />


See Also

Community Additions