Page 1 of 1

Where expression on enum with value conversion generates invalid query

Posted: Thu 20 Dec 2018 14:26
by Thomasdc
It seems as if the following issue has reappeared in the latest version: viewtopic.php?f=30&t=37405&p=130574#p130574

When using EFCore value conversions for enum properties and performing a comparison in a where clause, Devart ignores the value expression and generates a query using the numeric value of the enum.

When defining an enum value directly in the Where clause, it works. E.g.:

Code: Select all

dbContext
    .Set<Rider>()
    .Where(_ => _.Mount == EquineBeast.Mule)
    .ToList();
However, when using a variable, it generates an incompatible query (ORA-01722: invalid number):

Code: Select all

var enumValue = EquineBeast.Mule;
dbContext
    .Set<Rider>()
    .Where(_ => _.Mount == enumValue)
    .ToList();
EF Core version: 2.1.4
Database Provider: Devart.Data.Oracle.EFCore version 9.6.646

Re: Where expression on enum with value conversion generates invalid query

Posted: Fri 21 Dec 2018 19:40
by Shalex
Thank you for your report. We have reproduced the issue and will notify you when it is fixed.

Re: Where expression on enum with value conversion generates invalid query

Posted: Thu 10 Jan 2019 18:41
by Shalex
The bugs with using the GuidToStringConverter, EnumToStringConverter, ValueConverter classes in EF Core 2 are fixed: viewtopic.php?f=1&t=38262.

Re: Where expression on enum with value conversion generates invalid query

Posted: Fri 11 Jan 2019 07:58
by Thomasdc
Great! Thanks!