System.Linq.Dynamic.Core icon indicating copy to clipboard operation
System.Linq.Dynamic.Core copied to clipboard

Bug on where clause with composite string

Open GrandStrateguerre opened this issue 3 years ago • 1 comments

Here is what to include in your request to make sure we implement a solution as quickly as possible.

1. Description

Try to execute a query with a where as :

.Where("field1 == @0 & Field2 <> @1", "xxx", "") The second parameter is empty string.

2. Exception

No ecexption raise

3. technical details

Get the log of what entity generates : WHERE (('XXX' = "Extent1"."field1 ") AND ("Extent1"."field1 " IS NOT NULL) AND ( NOT (('' = "Extent1"."Field2 ") AND ("Extent1"."Field2 " IS NOT NULL))))

The error is in Field2 " IS NOT NULL=> shoud be IS NULL without NOT because we set a NOT before : image

with Field2 != @1 => gives the same issue

GrandStrateguerre avatar Aug 09 '22 14:08 GrandStrateguerre

Finally à replace by :

image

and it works.

It sems that a empty string is not interpreted like a null . Is is interpreded like a char.

And we see EF always add IS NOT NULL....

it is still a bit confusing :)

I let you close or do something ?

GrandStrateguerre avatar Aug 09 '22 16:08 GrandStrateguerre

https://github.com/zzzprojects/System.Linq.Dynamic.Core/pull/625

StefH avatar Aug 14 '22 12:08 StefH

@GrandStrateguerre I'll close this.

StefH avatar Aug 14 '22 12:08 StefH