This documentation is archived and is not being maintained.

Entity Data Model: Namespaces

A namespace in the Entity Data Model (EDM) is an abstract container for entity types, complex types, and associations. Namespaces in the EDM are similar to namespaces in a programming language: they provide context for the objects that they contain and they provide a way to disambiguate objects that have the same name (but are contained in different namespaces).

The ADO.NET Entity Framework uses a domain-specific language (DSL) called conceptual schema definition language (CSDL) to define conceptual models. The following CSDL code uses a namespace to identify a type that is defined in a different conceptual model. The example defines an entity type (Publisher) that has a complex type property (Address) that is imported from the ExtendedBooksModel namespace. Note that the Using element indicates that a namespace has been imported. Also note that the type of the Address property is defined by using its fully qualified name (ExtendedBooksModel.Address), indicating that this type is defined in the ExtendedBooksModel namespace.

      <Schema xmlns=""
              Namespace="BooksModel" Alias="Self">

        <Using Namespace="BooksModel.Extended" Alias="BMExt" />

	<EntityContainer Name="BooksContainer" >
          <EntitySet Name="Publishers" EntityType="BooksModel.Publisher" />

	<EntityType Name="Publisher">
            <PropertyRef Name="Id" />
          <Property Type="Int32" Name="Id" Nullable="false" />
          <Property Type="String" Name="Name" Nullable="false" />
          <Property Type="BMExt.Address" Name="Address" Nullable="false" />