Current filter:
                                You should refresh the page.
                                  • Hi,
                                    CriteriaToEFExpressionConverter conversion of InOperator should be improved. When using FilterPopupMode="CheckedList" with SelectAll option I can see a drop in performance for my custom IListServer implementation.

                                    CriteriaToEFExpressionConverter generate and expression like this for each values :
                                    x => x.Field == "Value1" || x.Field == "Value2" || x.Field == "Value3";
                                    An expression like this on would greatly improve performance for the SelectAll and all InOperator conversion :
                                    x => new fieldtype[] { "Value1", "Value2", "Value3" }.Contains(x.Field)
                                    This generates an In SQL call.

                                    You can reproduce the problem by adding FilterPopupMode="CheckedList"
                                    to FieldName="Id" GridColumn in EntityFrameworkInstantFeedbackMode.xaml
                                    of the demo center. Then click on the Select all checkbox in the filter popup.
                                    In the the demo you will get a stack overflow.
                                    In my custom implementation I get an "Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries" exception when calling the expression in a where for a source with a lot of rows.

                                • Ivan (DevExpress Support) 09.12.2019


                                  Thank you for the detailed description. Your suggestion sounds interesting, and I am discussing it with our developers. Please give me some additional time. I'll let you know as soon as I have any news.

                                  In the meantime, the purpose of including all/most values in the filter in this scenario is not entirely clear, since Server Mode data sources are intended to work with a large amount of data. Would you please provide more information about your use case?

                                • Yves Goulet 09.19.2019


                                  It's actually a feature that need's to be enabled. I know it can be slow but I would like to be enable to get it working without exceptions.


                                1 Solution

                                Creation Date Importance Sort by

                                Thank you for the clarification. We agree that this solution may help, although it will not resolve the issue completely. Our developers will research the possibility to utilize this approach in the future. However, as this improvement is not yet planned, I cannot provide you with precise time frames

                                As a possible solution, you can try to replace InOperator with a custom ICustomFunctionOperatorConvertibleToExpression function in the SubstituteFilter event handler. In this custom function, you can control how to convert it to an expression.

                                I recently used this approach to replace Like with a custom implementation. You can find that project in the attachment. Please pay special attention to the following classes:
                                - CriteriaPatcher - this class is intended to replace one operator with another. In your case, override its Visit(InOperator theOperator) method.
                                - LikeCustomFunction2 - the ICustomFunctionOperatorConvertibleToExpression.Convert method of this class returns an expression for the current filter.


                                See also:
                                - How to: Implement a Custom Criteria Language Function Operator
                                - How to: Implement Custom Functions and Criteria in LINQ to XPO