Open rt-tidaro opened 4 months ago
I have also run into this same problem.
@ajcvickers - I know your time is limited and I'm hoping you might be able to help point me in the right direction on how to resolve this error. I've spent some time trying to research this issue and can deduce that I need to add some handling now for the Contains
method, but it's unclear what else needs to be done so that the exception above is not thrown. I've created a working branch for this called contains-bug
. You can reproduce the issue by running the test here. Thanks in advance!
I was able to get around this issue by adding the following to the ConfigureConventions of my DBContext:
configurationBuilder.Properties<LocalDate>().HaveConversion<LocalDateValueConverter>();
This uses the built-in LocalDateValueConverter that is defined in this repo.
@StevenRasmussen I've put it on my personal backlog and hopefully I'll get some time to look soon.
Hello,
First of all, great library. Thanks for all your hard work!
After updating EF Core from 7.x to 8.04. and this library from 7.x to 8.0.1, I've encountered an error when trying to filter on
LocalDate
properties usingContains
:The above code will throw the following exception:
The same happens for other NodaTime types, e.g. LocalTime.
Since the method throwing the exception is called
ApplyTypeMappingsOnOpenJsonExpression
, my guess is that's related to how EF Core 8 has changed generating SQL forContains
with parameter collections (it's now usingOPENJSON
instead ofIN
). More information can be found here.This error doesn't occur when instead of using this library a custom converter for
LocalDate
is used:I've prepared a POC showing both cases: https://github.com/rt-tidaro/EfCoreNodaTimeContainsBugPoc
Thanks for help!