kendo-labs / dlinq-helpers

Add server paging, filtering and sorting via Dynamic Linq
71 stars 70 forks source link

doesnotcontain should include null and empty values #12

Open corydeppen opened 10 years ago

corydeppen commented 10 years ago

When the doesnotcontain operator is used, ToExpression is currently just using !{field}.{comparison}(@{index}). This leaves out rows where the field value is null or empty, though. Checking the field for null or empty should produce a more accurate query and result. I'd be happy to submit a quick PR if you agree.

burkeholland commented 10 years ago

Can you provide a specific test case where the results are not as desired? On a high level, I understand the issue, but it would be nice to have a more concrete example where something would fail.

corydeppen commented 10 years ago

For example, when trying to look at rows where descriptions don't contain "brake", the SQL that is generated by EF looks like (NOT([Extent1].[PartDescription] LIKE '%brake%')). This will return rows that have a string value that doesn't contain "brake", as well as rows where the value is an empty string, but will not include nulls because NULL is NOT LIKE and NOT NOT LIKE.