Where expression on enum with value conversion generates invalid query
Posted: 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.:
However, when using a variable, it generates an incompatible query (ORA-01722: invalid number):
EF Core version: 2.1.4
Database Provider: Devart.Data.Oracle.EFCore version 9.6.646
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();
Code: Select all
var enumValue = EquineBeast.Mule;
dbContext
.Set<Rider>()
.Where(_ => _.Mount == enumValue)
.ToList();
Database Provider: Devart.Data.Oracle.EFCore version 9.6.646