2.1.22 AnnotationElement

An AnnotationElement is a custom XML element that is applied to a conceptual schema definition language (CSDL) element. The AnnotationElement element and its child elements can belong to any XML namespace that is not in the list of reserved XML namespaces for CSDL. Consult the section for each CSDL element within this document to determine whether an AnnotationElement can be used for that element.

The following is an example of the AnnotationElement element.

 <EntityType Name="Content">
   <Key>
     <PropertyRef Name="ID" />
   </Key>
   <Property Name="ID" Type="Guid" Nullable="false" />
   <Property Name="HTML" Type="String" Nullable="false" MaxLength="Max" Unicode="true"
      FixedLength="false" />
   <CLR:Attributes>
     <CLR:Attribute TypeName="System.Runtime.Serialization.DataContract"/>
     <CLR:Attribute TypeName="MyNamespace.MyAttribute"/>
   </CLR:Attributes>
   <RS:Security>
     <RS:ACE Principal="S-0-123-1321" Rights="+R+W"/>
     <RS:ACE Principal="S-0-123-2321" Rights="-R-W"/>
   </RS:Security>
 </EntityType>

The following rules apply to the AnnotationElement element:

  • The namespace used in annotations MUST be declared or the namespace declaration MUST be in-lined with the annotation.

  • Annotations follow all other child elements. For example, when annotating an EntityType element, the AnnotationElement element follows all entity Key, Property, and NavigationProperty elements.

  • More than one named annotation can be defined per CSDL element.

  • For a given CSDL element, annotation element names can collide, as long as the combination of namespace plus element name is unique for a particular element.

  • Annotation is an XML element that contains a valid XML structure.