Bug #69803 So simple and Seriously bug, do you not find it?
Submitted: 20 Jul 2013 16:10 Modified: 22 Jul 2013 0:19
Reporter: bobi zhou Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:6.7.4.0 OS:Windows (xp/win7/win8)
Assigned to: Assigned Account CPU Architecture:Any
Tags: entityframework, MySQL

[20 Jul 2013 16:10] bobi zhou
Description:
i used EntityFrameWork 5.0 and MySql.Data.Entiy.dll in my project,but i found this bug.

the mysql.data.entity Generate a wrong sql.

it's so simple and Seriously bug,Why you did not find it.

How to repeat:
such the following code in C#:

string name = "123";
var query = from s in db.Set<User>() where s.Name.Contains(name) OrderBy(o=>o.Name) select s.Name;

but it Generate this sql:

SELECT
`Project1`.`Name`, 
FROM `User` AS `Project1`
WHERE ((LOCATE(@p__linq__0, `Extent1`.`Name`)) - 1) >= 0
ORDER BY `Project1`.`Name` ASC

where is the `Extent1` from ???

Suggested fix:
I hope you will solve it as soon as possible

thanks.
[22 Jul 2013 0:19] Fernando Gonzalez.Sanchez
Hi, this is a duplicate of bug 69751 and will be fixed as part of the that one.

Definitely an important issue, oddly enough only happens in Code first, not in Database first (in Db first the locate function call is received as a FunctionFragment, while in code first is received as string, therefore the logic that fuses queries (to remove nested queries) cannot cast a string to FunctionFragment and skip it).