Issue generated sql by using hasflag

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
Flo
Posts: 4
Joined: Mon 22 May 2017 08:49

Issue generated sql by using hasflag

Post by Flo » Tue 09 Feb 2021 09:33

If your linq2Sql in ef core looks like

Code: Select all

...
from item in items
where
item.Status.HasFlag(MyStatusEnum.Value1)
The generated sql is bugy. And looks like

Code: Select all

...
WHERE TO_NUMBER(BITAND("d".Status, Value1)) = 2
I use the nuget packaged Devart.Data.Oracle.EFCore (Version 9.14.1180).

If you use the bit-operator "&" the sql works correctly.

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

Re: Issue generated sql by using hasflag

Post by Shalex » Thu 11 Feb 2021 15:15

Thank you for your report. We have reproduced the issue and are investigating it. We will notify you about the result.

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

Re: Issue generated sql by using hasflag

Post by Shalex » Sat 20 Feb 2021 12:30

The bug with translating Enum.HasFlag to SQL in EF Core 3 and EF Core 5 is fixed in dotConnect for Oracle v9.14.1204: viewtopic.php?f=1&t=44490.

Flo
Posts: 4
Joined: Mon 22 May 2017 08:49

Re: Issue generated sql by using hasflag

Post by Flo » Tue 09 Mar 2021 07:57

Cool, thanks!

Post Reply