Object Expression

Object Expression is a special expression, which makes the query statement more concise.

When the query occurs among related tables, the query can be simplified to an Object Expression.

Take the following Select statements as an example:

SelectQuery qryOrder = OQL

  .SelectFrom(NW.Order)

  .Where(NW.Order.CustomerID

    .In(OQL

      .Select(NW.Customer.CustomerID)

      .From(NW.Customer)

      .Where(NW.Customer.ContactTitle == "Owner")));

The simplified version is:

SelectQuery qryOrder = OQL

  .SelectFrom(NW.Order)

  .Where(NW.Order == (NW.Customer.ContactTitle == "Owner"));

If you needn't to add other query conditions to the Where clause, it can be simplified in a further step:

SelectQuery qryOrder = OQL

  .SelectWhere(NW.Order == (NW.Customer.ContactTitle == "Owner"));

 

Related Topics

Boolean Expression