A newer version of this page is available. Switch to the current version.

JoinOperand Class

An operator that joins persistent objects on a specified condition, and calculates aggregate functions against matching objects.

Namespace: DevExpress.Data.Filtering

Assembly: DevExpress.Data.v19.2.dll

Declaration

public class JoinOperand :
    CriteriaOperator,
    IAggregateOperand,
    ICustomAggregateOperand
Public Class JoinOperand
    Inherits CriteriaOperator
    Implements IAggregateOperand,
               ICustomAggregateOperand

Remarks

The JoinOperand works only with eXpress Persistent Objects. Use the JoinOperand to build criteria and calculate aggregate functions using the properties of persistent objects without explicitly defined associations. Persistent objects applied to the current JoinOperand are called parent objects for the join. To specify the type of persistent objects to be joined with parent objects, use the JoinOperand.JoinTypeName property.

To access parent object properties in a join condition, use the Parent Relating Operator.

The JoinOperand does the following:

This example demonstrates how to load all employees who can issue refunds (the Employee and User table should have a one-to-one relationship).

using DevExpress.Xpo;
using DevExpress.Data.Filtering;
// ..

/* create via CriteriaOperator.Parse */
// string expr = "[<User>][[Oid] = [^.Oid] && [Permissions][[Action] = ?]]";
// CriteriaOperator filter = CriteriaOperator.Parse(expr, "Issue Refunds");

/* create via constructor */
CriteriaOperator joinCondition = new OperandProperty(nameof(Employee.Oid)) == new OperandProperty($"^.{nameof(User.Oid)}");
CriteriaOperator filterClause = new ContainsOperator(
    collectionProperty: new OperandProperty(nameof(User.Permissions)),
    condition: new OperandProperty(nameof(Permission.Action)) == new OperandValue("Issue Refunds")
    );
CriteriaOperator filter = new JoinOperand(
        joinTypeName: nameof(User),
        condition: joinCondition & filterClause
    );

XPCollection<Employee> employees = new XPCollection<Employee>(session, filter);

Refer to the Free Joins help topic for information on how to use the JoinOperand.

NOTE
  • For performance reasons, we recommend that you not use the JoinOperand when filtering or sorting the XPCollection on the client side, as this significantly increases the number of queries sent to the server.
  • JoinOperand may produce null instead of zero for an empty collection on a server side.

Inheritance

See Also