Skip to main content
A newer version of this page is available. .

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

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.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the JoinOperand class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

Inheritance

See Also