2.1.1 Schema

The Schema element is the top-level conceptual schema definition language (CSDL) construct that allows creation of a namespace.

The contents of a namespace can be defined by one or more Schema instances. The identifiers that are used to name types are unique within a Namespace. For instance, an EntityType cannot have the same name as a ComplexType within the same namespace. The Namespace forms a part of the type's fully qualified name.

The following is an example of the Schema element:

 <Schema Alias="Model" Namespace="Test.Simple.Model"
 xmlns:edm="http://schemas.microsoft.com/ado/2009/11/edm" 
 xmlns="http://schemas.microsoft.com/ado/2009/11/edm">

The following rules apply to the Schema element.

  • The CSDL document MUST have the Schema element as its root element.

  • The Namespace attribute is defined for each Schema element. Namespace is of type QualifiedName. A namespace is a logical grouping of EntityType elements, ComplexType elements, and Association elements.

  • A schema Namespace attribute cannot use the values "System", "Transient", or "Edm".

  • A schema definition can span across more than one CSDL document.

  • The Alias attribute can be defined on a Schema element. Alias is of the type SimpleIdentifier.

  • Schema can contain any number of AnnotationAttribute attributes. The full names of the AnnotationAttribute attributes cannot collide.

  • Schema can contain zero or more of the following child elements. The elements can appear in any given order.

  • In CSDL 2.0 and CSDL 3.0, Schema can contain zero or more of the following child elements.

    • Function

  • Schema can contain any number of AnnotationElement elements.

  • In CSDL 3.0, Schema can contain any number of Annotations elements.

  • In CSDL 3.0, Schema can contain any number of ValueTerm elements.

  • AnnotationElement elements MUST appear only after all other child elements of Schema.

Graphic representation in table format of the rules that apply to the Schema element.

All child elements are to appear in the order indicated. For all child elements within a given choice, the child elements can be ordered arbitrarily.