Bug #68586 MySQL .NET community connector and .Include doesn't work with EF 5.0 / EF 4.3.1
Submitted: 6 Mar 2013 16:59 Modified: 12 Mar 2013 21:28
Reporter: Mike Reust Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:6.6.5, 6.5.4 OS:Windows (7 SP1)
Assigned to: Fernando Gonzalez.Sanchez CPU Architecture:Any
Tags: mysql entity-framework connector include

[6 Mar 2013 16:59] Mike Reust
Description:
We have recently upgraded our code-base from EF 4.1 using edmx to EF 5.0 using code-first.  We've noticed that since the upgrade, all .Include statements have stopped working.

How to repeat:
Here's a simple code example:

var orders = dbContext.Orders.Include(x => x.OrderDetails).Take(10).ToList();
var orderDetails = orders.SelectMany(x => x.OrderDetails).ToList();

Using EF 4.1, executing both statements above generates a single sql statement.
Using EF 5.0, executing both statements above generates 11 sql statements.  1 for the orders.  Then another query per Order to grab the OrderDetails (i.e., SELECT N + 1).

Suggested fix:
I have confirmed this issue existing with both the 6.5.4 and 6.6.5 connectors.  The issue appears to be a mismatch between EF 5.0 and how the connector handles includes.
[6 Mar 2013 22:26] Mike Reust
Any chance I can get an ETA on this bug?  I would just like a ballpark, will it be fixed in a week, or not for a couple months?  Thanks!
[12 Mar 2013 15:37] Mike Reust
Correction, this appears to be an issue with EF 4.3.1 as well.  It seems to be more related to the fact that we switched to code-first.
[12 Mar 2013 21:28] Mike Reust
We have discovered the error.  It was on our side.  I apologize for the misdirection.
[12 Mar 2013 21:51] Fernando Gonzalez.Sanchez
Good to know, we were having trouble to repro : )