Up Query
DevForce Resource Center » Development guide » Query » Query using property navigation

Query using property navigation

Last modified on October 27, 2013 10:11

Querying using property navigation is a convenient syntax for accessing data from related entities.

Consider these familiar scenarios:

  • Get the line items (OrderDetails) of an order
  • Get the name of the order's parent customer
  • Get the parent customer's other orders

In DevForce you might write:

  • anOrder.OrderDetails
  • anOrder.Customer.CompanyName
  • anOrder.Customer.Orders

In each case, we want information (OrderDetails, Customers) related to a single entity (Order). The desired information exists somewhere in the entity’s object graph – the network of other entities that are related to it. Property navigation helps us traverse the network to reach related entities. 

The third example shows how you can chain navigation properties together. The statement anOrder.Customer.Orders navigates from a particular Order up to its parent Customer and then down to all of the parent Customer's other Orders. We call this "walking the object graph".

There are two kinds of navigation property:

  1. Scalar Navigation returns at most a single entity, typically a "parent" entity as in anOrder.Customer.

  2. Collection Navigation returns a list of related entities, typically the "children" of this entity as in aCustomer.Orders and anOrder.OrderDetails.
Tags: Navigation
Created by DevForce on September 29, 2010 14:59

This wiki is licensed under a Creative Commons 2.0 license. XWiki Enterprise 3.2 - Documentation. Copyright © 2020 IdeaBlade