Where expression on enum with value conversion generates invalid query

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
Thomasdc
Posts: 12
Joined: Sat 07 Jul 2018 14:20

Where expression on enum with value conversion generates invalid query

Post by Thomasdc » Thu 20 Dec 2018 14:26

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

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

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

Post by Shalex » Fri 21 Dec 2018 19:40

Thank you for your report. We have reproduced the issue and will notify you when it is fixed.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

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

Post by Shalex » Thu 10 Jan 2019 18:41

The bugs with using the GuidToStringConverter, EnumToStringConverter, ValueConverter classes in EF Core 2 are fixed: viewtopic.php?f=1&t=38262.

Thomasdc
Posts: 12
Joined: Sat 07 Jul 2018 14:20

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

Post by Thomasdc » Fri 11 Jan 2019 07:58

Great! Thanks!

Post Reply