Telerik OpenAccess Classic

Telerik OpenAccess ORM Send comments on this topic.
Path Expressions
See Also
Programmer's Guide > OpenAccess ORM Classic (Old API) > Telerik OpenAccess ORM OQL Reference > OQL - Object Query Language > The Select Statement > Path Expressions

Glossary Item Box

This documentation article is a legacy resource describing the functionality of the deprecated OpenAccess Classic only. The contemporary documentation of Telerik OpenAccess ORM is available here.

Path expressions allow you to traverse relationship paths that exist among objects. Both the "reference" (.) or "pointer" (->) notation are allowed and they can also be used interchangeably. OQL makes no distinction between pointers, embedded objects, or other references. You can specify all containment and relationship references using either symbol.

The following is a partial listing of an example Order class that contains a data-member named Employee of type Employee. The Employee class contains a string data-member called name.

C# Copy Code
class Order {
// . . .
Employee Employee;
// . . .
class Employee {
// . . .
string name;
// . . .

The following path expression is used to gain access to the id of class Employee:

OQL Copy Code
FROM OrderExtent AS o
WHERE o.employee.employeeID=5

The following example explains how to execute the query and than display the result

C# Copy Code
IObjectScope scope = ObjectScopeProvider1.GetNewObjectScope();
string query = "SELECT * FROM OrderExtent AS o WHERE o.employee.employeeID=5";
var result = scope.GetOqlQuery(query).Execute();
foreach (Order ord in result)
VB.NET Copy Code
Dim scope As IObjectScope = ObjectScopeProvider1.GetNewObjectScope()
Dim query As String = "SELECT * FROM OrderExtent AS o WHERE o.employee.employeeID=5"
Dim result As var = scope.GetOqlQuery(query).Execute()
For Each ord As Order In result

Please note the following two restrictions while using path expressions:

  • Access modifiers for class members in a path expression are ignored. However, you can access private, protected, namespace-visible and public members.
  • Path expressions may conflict with fully qualified class names, which use the dot symbol as a namespace delimiter. To avoid confusion, it is especially important to define an alias property in the [Persistent] attribute and to use the alias in the extent (refer to the The FieldAlias Attribute topic for more information).

See Also