Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

ICustomCriteriaOperatorQueryable.GetCriteria(CriteriaOperator[]) Method

When implemented by a class, returns a CriteriaOperator equivalent to a custom function used in LINQ to XPO expressions, based on specified function parameters.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v19.2.dll

Declaration

CriteriaOperator GetCriteria(
    params CriteriaOperator[] operands
)

Parameters

Name Type Description
operands CriteriaOperator[]

An array of CriteriaOperator containing function parameters.

Returns

Type Description
CriteriaOperator

A CriteriaOperator object which corresponds to parameters passed as the operands.

Remarks

The code below shows a sample GetCriteria implementation processing the operands.

public class MyConcatFunction : ICustomFunctionOperatorBrowsable, ICustomFunctionOperatorFormattable,
    ICustomCriteriaOperatorQueryable {
    const string FunctionName = "MyConcat";
    // ...

    public CriteriaOperator GetCriteria(params CriteriaOperator[] operands) {            
        if(operands == null || operands.Length != 1 || !(operands[0] is MemberInitOperator)) 
            throw new ArgumentException(FunctionName);
        CriteriaOperatorCollection operandCollection = new CriteriaOperatorCollection();
        foreach(XPMemberAssignment operand in ((MemberInitOperator)operands[0]).Members) {
            operandCollection.Add(operand.Property);
        }
        return new FunctionOperator(FunctionName, operandCollection);
    }
}

To see the entire example, see the How to: Implement Custom Functions and Criteria in LINQ to XPO.

See Also