Freigeben über


2.1.4 NavigationProperty

NavigationProperty elements define non-structural properties on entities that allow for navigation from one Entity to another via a relationship. Standard properties describe a value that is associated with an entity, while navigation properties describe a navigation path over a relationship. For example, given a relationship between Customer and Order entities, an Order EntityType (section 2.1.2) can describe a NavigationProperty"OrderedBy" that represents the Customer instance associated with that particular Order instance.

The following is an example of a NavigationProperty element.

 <NavigationProperty Name="Orders" Relationship="Model1.CustomerOrder" FromRole="Customer" ToRole="Order" />

The following rules apply to the NavigationProperty element:

  • NavigationProperty MUST have a Name defined.

  • NavigationProperty MUST have a Relationship attribute defined.

  • The Relationship attribute can be either a namespace qualified name or an alias qualified name of an Association (section 2.1.8) element that is in scope.

  • NavigationProperty MUST have a ToRole attribute defined. ToRole specifies the other end of the relationship and refers to one of the role names that is defined on the Association.

  • NavigationProperty MUST have a FromRole defined. FromRole is used to establish the starting point for the navigation and refers to one of the role names that is defined on the Association.

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

  • NavigationProperty can contain a maximum of one Documentation element.

  • NavigationProperty can contain any number of AnnotationElement elements.

  • In CSDL 3.0, NavigationProperty can have a ContainsTarget defined. When ContainsTarget is absent, it defaults to "false". When it is set to "true", ContainsTarget indicates containment NavigationProperty (section 2.1.39).

  • In CSDL 3.0, NavigationProperty can contain any number of ValueAnnotation elements.

  • Child elements of NavigationProperty are to appear in this sequence: Documentation, AnnotationElement.

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

All child elements are to appear in the order indicated.