Right after upgrading to .NET Core 3.1 and EF Core 3.1 with DevArt 9.10, I started getting ORA-00904 invalid identifier code.
Assume the following:
Code: Select all
public enum ColorType
{
Red = 0,
Blue = 1
}
public class SomeObject
{
public int Id {get; set;}
public ColorType? Color {get; set;}
}
The above is a simple object with ColorType being nullable property. Assume that SomeObject is mapped to a table and the following EF Core query:
Code: Select all
var query = await table1.AsNoTracking()
.Where(t => t.ColorType == ColorType.Blue).Select(h => h.Id).ToListAsync();
With the above code, I would get ORA-00904: "BLUE": invalid identifier with the following produced SQL:
Code: Select all
SELECT "g".ID
FROM <some_table> "g"
WHERE "g".Color = Blue
Notice that instead of using integers, the SQL query uses string literal of the enum, which of course is wrong. Strangely, I had used enum in other cases, and it worked correctly. The only difference was the nullable part, which in this case affects how the SQL is generated. Only happens in NET Core 3.1/EF Core 3.1. Works correctly in .NET Core 2.2/EF Core 2.4