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.v24.1.dll
NuGet Packages: DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap, DevExpress.Xpo
NuGet Package: DevExpress.Xpo
Declaration
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.