New behaviour in EF4 code generation

New behaviour in EF4 code generation

Postby MarcAlbaum » Thu 24 Sep 2015 08:45

Hi guys,

I encountered a new effect within the SQL code generation of the Entity Framework 4 after switching from dotConnect v8.3.135 to 8.5.464:

My scenario: Oracle table "Shows" with a column "IsBestShow" declared as Number(1,0) NOT NULL, containing several million rows. I use that column as bool, containing less than 1 promille "1" values, rest "0". There is a bitmap index on that column. I generated the EF4 model from the database. The property in the entity is created as not nullable bool, just as I need it. Now I want to retrieve all rows marked as IsBestShow:

Code: Select all
            using ( Entities e = new Entities() )
            {
                return e.Shows.Include( "OtherTable" )
                    .Where( x => x.IsBestShow )
                    .OrderByDescending( x => x.OtherValueColumn )
                    .ToList();
            }


In v8.3 the where clause was generated like this:
WHERE "Extent1".IsBestShow = 1
This worked fine and fast, the index was used.

In v8.5 that changed:
WHERE "Extent1".IsBestShow <> 0
This works not as well because for reasons unknown, Oracle won't use the index and performs a full table scan that lasts for several hours instead of a few seconds.

My question: Does a setting exist, that revert code generation in EF to the previous version or can I achieve the old behaviour in another way?

I also tried a second approach in using a OracleFunctions.Hints(...) to force the use of the index. That didn't work, Oracle ignored the hint and the index.

Any help would be appreciated.
Best regards
Marc


Update:
Same effect with EF 6.1.3.
MarcAlbaum
 
Posts: 3
Joined: Thu 24 Sep 2015 08:38

Re: New behaviour in EF4 code generation

Postby Shalex » Fri 25 Sep 2015 06:23

Thank you for your report. We will notify you when the corresponding option is implemented.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44

Re: New behaviour in EF4 code generation

Postby MarcAlbaum » Fri 25 Sep 2015 08:16

Hello Shalex,

thank you for your reply.

To consider my options, I would like to know a rough guess about the timeframe of this feature. Do you think we are talking about days or weeks, so I can wait for it or rather weeks and months, so I have to build a work-a-round?

In the latter case I will treat the bool column as decimal so I have full control of the comparator.

Best regards
Marc
MarcAlbaum
 
Posts: 3
Joined: Thu 24 Sep 2015 08:38

Re: New behaviour in EF4 code generation

Postby Shalex » Mon 28 Sep 2015 10:18

We are planning to implement this feature in the next public build. An approximate timeframe is a week. We will notify you when it is available for download.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44

Re: New behaviour in EF4 code generation

Postby MarcAlbaum » Mon 28 Sep 2015 10:56

That sounds very good, thank you for your very fast reaction!
MarcAlbaum
 
Posts: 3
Joined: Thu 24 Sep 2015 08:38

Re: New behaviour in EF4 code generation

Postby Shalex » Thu 01 Oct 2015 17:11

New build of dotConnect for Oracle 8.5.506 is available for download now: http://forums.devart.com/viewtopic.php?f=1&t=32579. Please try it and notify us about the result.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle